Team LiB
Previous Section Next Section

pack200Compress a JAR file

Synopsis

pack200 [options] outputfile jarfile

Description

pack200 tightly compresses a JAR file using the compression algorithm defined by JSR 200 and the standard gzip compression algorithm. Notice that the output file is specified on the command line before the input JAR file.

Basic options

All pack200 options exist in both a long form that begins with a double dash and a single-letter form that begins with a single dash. When the option requires a value, the value should be separated from the long form of the option with an equals sign and no space or should immediately follow the short form with no intervening space or punctuation.


--config-file= file, -f file

Reads options from the specified configuration file. file should be a java.util.Properties file in name=value format. Supported property names are the same as the long-form option names listed here, with with hyphens converted to periods.


--effort= value, -E value

Specifies how hard to try to pack the JAR file. value must be a digit between 0 and 9. 0 means no compression at all and simply produces a copy of the input JAR file. The default is 5.


--help, -h

Displays a help message and exits.


--log-file= file, -l file

Log output to file.


--no-gzip, -g

Tells pack200 not to apply gzip compression to the packed JAR file. Use this option if you want to apply a different compression filter, such as bzip2. The default is --gzip.


--no-keep-file-order, -o

Allows pack200 to reorder the elements of the JAR file. --keep-file-order is the default.


--quiet, -q

Suppresses output messages.


--pass-file= file, -P file

Passes the specified file without compression. If file ends with a /, all files in the directory are passed through without packing. This option may be specified multiple times.


--repack, -r

Packs the specified JAR file, and then immediately unpacks it. In this case, the outputfile specified on the command line should be the name of a JAR file. It is important to do a pack/unpack cycle on a JAR file before signing it with jarsigner because the pack/unpack cycle reorders some internal elements of a class file and invalidates any digital signatures or checksums in the JAR file manifest.


--strip-debug, -G

Permanently strips debugging attributes from the Java class files instead of compressing them. This makes it harder to debug the resulting JAR file.


--verbose, -v

Displays more output messages.


--version, -V

Displays version number and exits.

Advanced packing options

The following options provide fine control over the compression performed by pack200.


--deflate-hint= value, -H value

Specifies whether pack200 should preserve the deflation status of each entry in the input JAR file. The default value is keep, which preserves the status. A value of TRue places a hint in the packed archive that the unpacker should deflate all entries after unpacking them. A value of true places a hint in the packed archive that the unpacker should store each entry in the JAR file without deflation. Using a value of TRue or false reduces the packed file size slightly because deflation hints do not need to be stored for each entry.


--modification-time= value, -m value

With the default value of keep, pack200 transmits the modification time of each entry in the JAR file. If you specify latest instead, only the most recent modification time is transmitted, and is applied to all entries when they are unpacked.


--segment-limit= n, -S n

Sets a target segment size of n. Pack200 files may be divided into separately packed segments in order to reduce the amount of memory required by the unpacker. This option sets the approximate size of each segment. The default value is one million bytes. The value -1 produces a single large segment, and the value 0 produces a single segment for each class file. Larger segment sizes result in better compression ratios, but require additional memory to unpack.


--unknown-attribute= action, -U action

Specifies how pack200 should handle unknown class file attributes. The default action is pass, which specifies that the entire class file will be transmitted with no compression. An action of error specifies that pack200 should produce an error message. An action of strip says that the attribute should be stripped from the class file.


--class-attribute= name=action, -C name=action,


--code-attribute= name=action, -D name=action,


--field-attribute= name=action, -F name=action,


--method-attribute= name=action, -M name=action,

These four options specify how pack200 should handle specific named class, field, method, and code attributes in a class file. The name of the attribute is specified by name. The action may be any of the pass, strip, and error values supported by the --unknown-attribute option. The action may also be a "layout string" that specifies how the attribute should be packed. See the Pack200 specification for details on the layout language. These options may be repeated to specify handling for more than one attribute.

See also

unpack200

    Team LiB
    Previous Section Next Section