Automatic creation of Java archives
PrefaceCommand line versionEclipse plugin
Bernd Eggink, monoped@users.sourceforge.net Project page: SourceForge.net
File parameters
Following the options, an arbitrary number of file or directory paths can be specified. If a specific path is encountered more than once, only the first corresponding file is copied to the output; so the order of parameters may be relevant.

How a file parameter is processed, depends on its type.

  • Classes: Classes are specified in the form classname.class. Autojar searches the class path for the corresponding file. If found, the file is copied to the output archive. Autojar then scans the file's bytecode for other referenced classes and repeats this process recursively as long as necessary.

    The last component of the class name may contain wildcards * and ?. In this case, all classes matching the pattern are looked up and inserted. For example, a.b.*.class copies all classes from the package a.b to the output archive.

    A pattern of the form **.class causes a recursive copy. If a parameter a.b.**.class is given, all classes belonging to package a.b and all classes belonging to its subpackages (a.b.x, a.b.x.y, a.b.z etc.) will be included.

  • .jar and .war files: All files from the archive are copied to the output, if not yet present, except the "META-INF" directory. Class files are treated as described above.
  • .zip files: Like .jar files, but class files are not handled specially.
  • Other files: If the path denotes an existing file, it is copied to the output. Otherwise, if the path is relative, and a search path for files has been provided (option -p or -b), Autojar tries to find the corresponding file using the search path. Like with classes, the name part may contain wildcards. If the last component is **, the corresponding directory will be looked up and copied to the output recursively, including all files and subdirectories.

    Supplying a pure ** as a parameter normally doesn't make sense, as it would add the complete content of the current working directory. Supplying a class file with an absolute path name doesn't make sense either. It will be treated like a normal file; no recursive class scan will take place.

  • Directories: Directories are copied recursively, except for files matching an exclude pattern (see below). All files, including class files, are treated as normal files.
  • The special parameter -C directory name has the same meaning as with the jar command: The working directory is temporarily set to directory, then name is evaluated, and then the working directory is reset to the original value. name may contain wildcards (* and ?). A single dot denotes the directory as a whole.
  • The special parameter -X pattern defines an exclude pattern for normal files. It affects subsequent parameters which generate a file list (directories, patterns, or "."). Files matching any pattern are ignored. If multiple exclude patterns are given, they are logically combined by "or". A pattern consisting of a single hyphen (-X - or -X-) clears the pattern list, so that (up to the next -X) all files are copied again.
    This parameter can be used, for example, to skip special directories like .svn or .cvs.

Note that -C and -X are not options. If one of these happens to be the first non-option parameter, it has to be prefixed by -- to prevent Autojar from interpreting it as an option (see Options).

Classes from the Java runtime library never go into the output file.

At the end of the run, if option -q is not present, Autojar prints a list of classes and files that couldn't be found, and a list of unused search path components

up
Created 2009-03-14 by mopcoge