Pack200 is a compression technology included in Java 1.5.0. It was designed for compressing jars and works most efficiently on Java class files. Using Pack200 compression can reduce the size of a jar by about 60%.
Pack200 is not a lossless compression. Packing and unpacking will produce a jar that is semantically the same as the original, but classfile structures will be rearranged; the resulting jar will not be identical to the original. However, this reordering is idempotent so a second pack-unpack will not further change the jar.
Signing a jar hashes the contents and stores the hash codes in the manifest. Since packing and unpacking a jar will modify the contents, the jar must be normalized prior to signing. Normalizing the jar will also be refered to as repacking the jar.
The Jar Processor is a tool provided by the org.eclipse.update.core bundle that will recursively run the pack200, signing and unpack200 tools on a jar and its nested jars. The jar processor can be exported into a self contained jar using the
org.eclipse.update.internal.jarprocessor/jarprocessor.jardesc jar description file. The jar processor can also be accessed through the
The jarprocessor understands the following command-line options:
|–repack||Normalize the jar by calling the pack200 tool with the -repack option.|
|–pack||Pack the jar using the pack200 tool|
|–sign <command>||Sign the jar using the provided command. The sign command will be provided the name of the jar to sign as its first argument.|
|–unpack||Unpack a pack.gz file into a jar using the unpack200 tool.|
|–outputDir <directory>||The directory in which to place the results.|
The repack, sign and pack options can be specified together. When specifying all 3, the input jar will first be normalized, then signed, then packed. The output will be the signed jar and a packed jar.pack.gz file.