« Continuum build tool | Main | JarJar - Jar Jar Linking tool »

Autojar - Jar builder





Autojar helps creating jar files of minimal size from different inputs like own classes, external archives etc. It starts from one or more given classes (e.g., an applet), recursively searches the bytecode for references to other classes, extracts these classes from the input archives, and copies them to the output. The resulting archive will only contain the classes you really need. Thus you can keep size and loading time of applets low or make applications independent of installed libraries.
In a similar way, autojar can search directories and archives for other resources (like image files), extract them and copy them to the output.

Note that autojar in principle can't know which classes will be loaded dynamically (by Class.forName()). However, starting from version 1.3, one can tell autojar to search the bytecode for invocations of Class.forName() and inform you correspondingly. In some cases autojar actually can find out which classes are to be loaded, and add them automatically to the output.

Autojar uses the excellent bcel package (http://jakarta.apache.org/bcel/).

Using Autojar

Autojar comes in two flavours with equal functionality. The file autojar.jar is th self-contained version, created by autojar itself. Use it if you don't have BCEL installed. It is started by the command

java -jar autojar.jar [option...] [file...]

The second version, autojar-core.jar, is much smaller, as it contains only the autojar classes. You must have bcel-5.1.jar (or better) in your classpath to use it. Start it like this:

java -cp autojar-core.jar:bcel.jar de.uni_hamburg.eggink.autojar.Autojar [option...] [file...]

(As usual, Windows users have to use semicolon instead of colon in the classpath). Any program parameter (options and files) may be supplied directly on the command line or read from a text file. Example:

java -jar autojar.jar -o old.jar @params -c in.jar @class-list

Each line in params and class-list is considered a program parameter and inserted into the command line sequence.


Project Home Page
http://autojar.sourceforge.net/

Download Autojar
https://sourceforge.net/projects/autojar

TrackBack

TrackBack URL for this entry:
http://freejdk.org/mt-tb.cgi/34