Automatic creation of Java archives
Preface
Command line version
Eclipse plugin
Bernd Eggink, monoped@users.sourceforge.net SourceForge project page
englischGerman version
Preface
Description
Autojar creates jar archives of minimal size from different sources (classes, directories, libraries). Starting from one or more classes, it scans the bytecode recursively for other classes, extracts them from their archives if necessary, and adds them to the output file. The resulting archive contains only classes that are really needed. Thus the size and loading time of applets can be kept low, and applications can be made self-contained.
In a similar way, Autojar can search directories and archives for other resources (like image files), extract them and copy them to the output.

Other possible uses are: Merging several libraries into one, or replacing single classes in an archive without manual unpacking and re-packing.

A potential problem is reflection. Autojar doesn't know which classes the program will load during runtime. It can, however, search the bytecode for invocations of Class.forName() and issue warnings. Moreover, if a the class name is a constant, Autojar can look up this class and add it automatically.

Autojar works with JRE 1.4.2 or later. It uses classes from the BCEL library (http://jakarta.apache.org/bcel/) and from log4j (http://logging.apache.org/log4j/).

As of version 2.0, Autojar comes in two variants: A command line version, which is controlled by options, and an Eclipse plugin.

History
Version 2.0: Heavy refactoring in conjunction with the plugin development. Class org.sourceforge.autojar.Ajar provides a public interface which both Autojar and the plugin use. Logging is now done by log4j.
Wildcards '?' and '*' are expanded in class names, so that, for example, all classes of a package can be taken globally.
War archives are now treated like jar files, zip files are extracted and inserted automatically.
First version of the Eclipse plugin.

The latest versions autojar-2.0pre1 and autojar-plugin-1.0pre1 are preliminary versions, intended mainly for brave beta testers!

Version 1.3.1: Minor bug fixes.
With option -v, autojar now outputs a list of archives that are included in the classpath, but never used.
New option -X allows exclusion of file and folder names.

Version 1.3: Project moved to SourceForge.
Some bugs fixed. Non-class files are now handled correctly even if their names contains more than one dot.
Dynamic loading is detected. Options -d and -a added.
Any command line parameter may be of the form @file, not just the first.

Version 1.2.2: Some bugs fixed.
New options: -e, -q, -D.
Wildcards ? and * allowed in search paths.
Improved dependency checking.
Missing files are reported.

Version 1.1: Along with option -p, a search path for non-class files may be supplied (e.g., .gif files). Alternatively option -b ("both") tells autojar to search the class path for non-class files as well.

Bugs
Please report bugs via the SourceForge bug system.
up