Skip to main content
Jump to: navigation, search


Revision as of 18:11, 20 April 2006 by Aniefer (Talk | contribs)


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%. By packing the jars placed on an update site and enabling update to unpack those jars after download, the amount of data downloaded during an update can be greatly reduced.


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.

Jar Processor

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 used during a build to repack, sign and pack jars for an update site. It is also used by eclipse itself to unpack compressed jars downloaded from an update site.

To use the jar processor in a 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 org.eclipse.update.core.siteOptimizer application. The jar processor requires a 1.5 jre to perform the pack and unpack.

The jarprocessor understands the following command-line options:

Option Effect
–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.


The jar processor takes as input either a .zip file, a .jar (or .pack.gz) file, or a directory.

  • If the input is a zip file, then each contained .jar (or .pack.gz if unpacking) will be processed. A new .zip file will be created in the output directory containing the results.
  • If the input is a single .jar (or .pack.gz file) then that file is processed.
  • If the input is a directory then all .jar (or .pack.gz files) in that directory, and its subdirectories, will be processed.

If the input is a zip file, then additional options may be specified by placing a file in the root of the zip. This file is a java properties file and the following properties are supported:

  • pack.excludes : A comma-delimited list of JARs that should not be packed or repacked.
  • sign.excludes : A comma-delimited list of JARs that should not be signed.
  • <jarname>.pack.args : A comma-delimited list of additional arguments that should be passed to pack200 when packing any jar with name <jarname>.


java -jar /eclipse/startup.jar -application org.eclipse.update.core.siteOptimizer -jarProcessor
 -repack -sign -outputDir ./out

This will run the jar processor using the siteOptimizer application. For each jar file in, the jar processor will normalize the jar by repacking it, then sign it by executing <jar>. A zip ./out/ will be created containing the repacked signed jars. Any non-jar file in the input will be copied over to the ./out/ as is.

java -jar /eclipse/startup.jar -application org.eclipse.update.core.siteOptimizer -jarProcessor
 -repack -sign -pack -outputDir ./out

This command will do the same as the first example, but will also pack the signed jars. The output ./out/ file will contain both the signed jars and the .jar.pack.gz versions.

java -jar /eclipse/startup.jar -application org.eclipse.update.core.siteOptimizer -jarProcessor
 -pack myJar.jar

java -jar /eclipse/startup.jar -application org.eclipse.update.core.siteOptimizer -jarProcessor
 -unpack myJar.jar.pack.gz

These two commands are the inverses of each other. The first will pack myJar.jar and produce a myJar.jar.pack.gz. Since no outputDir is specified, the .pack.gz file will be created in the current directory. If myJar.jar contained a nested jar, then that nested jar will be packed first and the resulting myJar.jar.pack.gz would contain a nested nested.jar.pack.gz. The second command will unpack the myJar.jar.pack.gz file and produce a myJar.jar. The nested nested.jar.pack.gz will also be unpacked. Again, because no outputDir is specified, the output will be in the current directory, overwriting the original myJar.jar.

Pack200 location

By default, the jar processor will look for the pack200 and unpack200 executables first in the ${java.home}/bin directory and then on the system search path. However, the location of these tools can also be specified using the java system property org.eclipse.update.jarprocessor.pack200. The value is expected to be the directory containing the pack200 and unpack200 executables or one of the following special values:

  • "@jre" - find unpack200 in ${java.home}/bin
  • "@path" - find unpack200 on the search path
  • "@none" - pack200 not supported, download normal jars from update sites.

External Links

Pack200 and Compression
JAR Packing tool
JAR Unpacking tool
JAR Signing and Verification tool

Back to the top