502 Building Java Applications for the iSeries Server with VisualAge for Java 3.5
򐂰 -additionalFilesDirectory baseDirectory
Specifies the base directory for additional files. This should be the parent directory of the
directory where the package path starts. For example, if the foo.class file in the
com.ibm.mypackage package is located in the C:\dir1\subdir2\com\ibm\mypackage\
directory, then specify a base directory of C:\dir1\subdir2. The -additionalFilesDirectory
option may be abbreviated to -afd. The default is the current directory.
򐂰 -package package1[,package2[...] ]
The packages that are required. Entries are separated by commas (no spaces). The
-package option may be abbreviated to -p. Package names are specified in standard
syntax, such as com.ibm.component.
Note: The specified packages are simply included in the output. No additional
dependency analysis is done on the files in a package, unless they are explicitly specified
as required files.
򐂰 -extract [baseDirectory]
Extracts the desired entries of the source JAR or ZIP file into the specified base directory,
without generating a new JAR or ZIP file. This option enables the user to build up a
customized JAR or ZIP file empirically, based on the requirements of their particular
application. When this option is specified, -additionalFile, -additionalFilesDirectory, and
-destination are ignored. The -extract option may be abbreviated to -x. By default, no
extraction is done. The default base directory is the current directory.
򐂰 -split [splitSize]
Splits the source JAR or ZIP file into smaller JAR or ZIP files. No ZIP entries are added or
excluded; the entries in the source JAR or ZIP file are simply distributed among the
destination JAR or ZIP files. The split size is in units of kilobytes (1024 bytes) and specifies
the maximum size for the destination files. The destination files are created in the current
directory. They are named by appending integers to the source file name; any existing files
by the same name are overwritten. For example, if the source JAR file is myfile.jar, the
destination JAR files would be myfile0.jar, myfile1.jar, and so on. When this option is
specified, all other options except -source and -verbose are ignored. The -split option may
be abbreviated to -sp. The default split size is 2 MB (2048 KB).
򐂰 -verbose
Causes progress messages to be displayed. The -verbose option may be abbreviated to
-v. The default is non-verbose.
򐂰 -help
Displays the help text. The -help option may be abbreviated to -h.
13.2.2 JarMaker example
In this example, the source JAR file is named myJar.jar and is in the current directory. To
create a JAR file that contains only the classes mypackage.MyClass1 and
mypackage.MyClass2, along with their dependencies, enter:
java utilities.JarMaker -source myJar.jar -requiredFile
mypackage/MyClass1.class,mypackage/MyClass2.class
Alternatively, the same function can be done with a Java program as shown here:
import utilities.JarMaker;
// Set up the list of required files.
Vector classList = new Vector ();
classList.addElement ("mypackage/MyClass1.class");
classList.addElement ("mypackage/MyClass2.class");

Get Building Java Applications for the iSeries Server with VisualAge for Java 3.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.