AS/400 Toolbox for Java \ Utility classes \ JarMaker

AS400ToolboxJarMaker

While the JAR file format was designed to speed up the downloading of Java program files, the AS400ToolboxJarMaker class generates an even faster loading Java Toolbox JAR file through its ability to create a smaller JAR file from a larger one.

Also, the AS400ToolboxJarMaker class can unzip a JAR file for you to gain access to the individual content files for basic use.

Flexibility of AS400ToolboxJarMaker

All of the AS400ToolboxJarMaker functions are performed with the AS400ToolboxJarMaker class and the AS400ToolboxJarMaker subclass:

According to your needs, you can invoke the AS400ToolboxJarMaker methods from within your own Java program or as a standalone program (java utilities.JarMaker [options]). For a complete set of options available to run at a command line prompt, see the following:

Using AS400ToolboxJarMaker

Uncompressing a JAR file

Suppose you wanted to uncompress just one file bundled within a JAR file. AS400ToolboxJarMaker allows you to expand the file into one of the following:

For example, with the following code, you are extracting AS400.class and all of its dependent classes from jt400.jar:

    java utilities.AS400ToolboxJarMaker -source jt400.jar
        -extract outputDir
        -requiredFile com/ibm/as400/access/AS400.class

Splitting up a single JAR file into multiple, smaller JAR files

Suppose you wanted to split up a large JAR file into smaller JAR files, according to your preference for maximum JAR file size. AS400ToolboxJarMaker, accordingly, provides you with the split(jarFile, splitSize) function.

In the following code, jt400.jar is split into a set of smaller JAR files, none larger than 300K:

    java utilities.AS400ToolboxJarMaker -split 300

Removing unused files from a JAR file

With the AS/400ToolboxJarMaker subclass of JarMaker, you can exclude any AS/400 Toolbox for Java files not needed by your application by selecting only the AS/400 Toolbox for Java components, languages, and CCSIDs that you need to make your application run. This extension of AS400ToolboxJarMaker also provides you with the option of including the JavaBean files associated with the components you have chosen, or excluding those that are unnecessary.

In the following command, for example, a JAR file is created containing only those Toolbox classes needed to make the Command Call and Program Call components of the Toolbox work:

    java utilities.AS400ToolboxJarMaker -component CommandCall,ProgramCall

Additionally, if it is unnecessary to convert text strings between Unicode and the double byte character set (DBCS) conversion tables, you can create a 400K byte smaller JAR file by omitting the unneeded conversion tables with the -ccsid option:

    java utilities.AS400ToolboxJarMaker -component CommandCAll,ProgramCall -ccsid 61952
Notes:
  1. The conversion table for CCSID 61952 must be included via the -ccsid option when including the integrated file system classes in the jar file.
  2. Conversion classes are not included with the program call classes. When including program call classes the conversion classes used by your program must also be explicitly included via the -ccsid option.

[ Information Center Home Page | Feedback ] [ Legal | AS/400 Glossary ]