| .\" Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. |
| .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| .\" |
| .\" This code is free software; you can redistribute it and/or modify it |
| .\" under the terms of the GNU General Public License version 2 only, as |
| .\" published by the Free Software Foundation. |
| .\" |
| .\" This code is distributed in the hope that it will be useful, but WITHOUT |
| .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| .\" version 2 for more details (a copy is included in the LICENSE file that |
| .\" accompanied this code). |
| .\" |
| .\" You should have received a copy of the GNU General Public License version |
| .\" 2 along with this work; if not, write to the Free Software Foundation, |
| .\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| .\" |
| .\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| .\" or visit www.oracle.com if you need additional information or have any |
| .\" questions. |
| .\" |
| .\" Automatically generated by Pandoc 2.3.1 |
| .\" |
| .TH "PACK200" "1" "2018" "JDK 13" "JDK Commands" |
| .hy |
| .SH NAME |
| .PP |
| pack200 \- transform a Java Archive (JAR) file into a compressed pack200 |
| file with the Java gzip compressor |
| .SH SYNOPSIS |
| .PP |
| \f[CB]pack200\f[R] [\f[I]\-opt...\f[R] | \f[I]\-\-option=value\f[R]] |
| \f[I]x.pack[.gz]\f[R] \f[I]JAR\-file\f[R] |
| .TP |
| .B \f[I]\-opt...\f[R] | \f[I]\-\-option=value\f[R] |
| Options can be in any order. |
| The last option on the command line or in a properties file supersedes |
| all previously specified options. |
| See \f[B]Options for the pack200 Command\f[R]. |
| .RS |
| .RE |
| .TP |
| .B \f[I]x.pack[.gz]\f[R] |
| Name of the output file. |
| .RS |
| .RE |
| .TP |
| .B \f[I]JAR\-file\f[R] |
| Name of the input file. |
| .RS |
| .RE |
| .SH DESCRIPTION |
| .PP |
| The \f[CB]pack200\f[R] command is a Java application that transforms a JAR |
| file into a compressed \f[CB]pack200\f[R] file with the Java gzip |
| compressor. |
| This command packages a JAR file into a compressed \f[CB]pack200\f[R] file |
| for web deployment. |
| The \f[CB]pack200\f[R] files are highly compressed files that can be |
| directly deployed to save bandwidth and reduce download time. |
| .PP |
| Typical usage is shown in the following example, where |
| \f[CB]myarchive.pack.gz\f[R] is produced with the default \f[CB]pack200\f[R] |
| command settings: |
| .RS |
| .PP |
| \f[CB]pack200\ myarchive.pack.gz\ myarchive.jar\f[R] |
| .RE |
| .PP |
| \f[B]Note:\f[R] |
| .PP |
| This command shouldn\[aq]t be confused with \f[CB]pack\f[R]. |
| The \f[CB]pack\f[R] and \f[CB]pack200\f[R] commands are separate products. |
| The Java SE API Specification provided with the JDK is the superseding |
| authority, when there are discrepancies. |
| .SH EXIT STATUS |
| .PP |
| The following exit values are returned: 0 for successful completion and |
| a number greater than 0 when an error occurs. |
| .SH OPTIONS FOR THE PACK200 COMMAND |
| .PP |
| The \f[CB]pack200\f[R] command has several options to fine\-tune and set |
| the compression engine. |
| The typical usage is shown in the following example, where |
| \f[CB]myarchive.pack.gz\f[R] is produced with the default \f[CB]pack200\f[R] |
| command settings: |
| .RS |
| .PP |
| \f[CB]pack200\ myarchive.pack.gz\ myarchive.jar\f[R] |
| .RE |
| .TP |
| .B \f[CB]\-r\f[R] or \f[CB]\-\-repack\f[R] |
| Produces a JAR file by packing and unpacking a JAR file. |
| The resulting file can be used as an input to the \f[CB]jarsigner\f[R] |
| tool. |
| The following example packs and unpacks the myarchive.jar file: |
| .RS |
| .RS |
| .PP |
| \f[CB]pack200\ \-\-repack\ myarchive\-packer.jar\ myarchive.jar\f[R] |
| .RE |
| .RS |
| .PP |
| \f[CB]pack200\ \-\-repack\ myarchive.jar\f[R] |
| .RE |
| .RE |
| .TP |
| .B \f[CB]\-g\f[R] or\f[CB]\-\-no\-gzip\f[R] |
| Produces a \f[CB]pack200\f[R] file. |
| With this option, a suitable compressor must be used, and the target |
| system must use a corresponding decompresser. |
| .RS |
| .RS |
| .PP |
| \f[CB]pack200\ \-\-no\-gzip\ myarchive.pack\ myarchive.jar\f[R] |
| .RE |
| .RE |
| .TP |
| .B \f[CB]\-\-gzip\f[R] |
| (Default) Post\-compresses the pack output with \f[CB]gzip\f[R]. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-G\f[R] or \f[CB]\-\-strip\-debug\f[R] |
| Strips debugging attributes from the output. |
| These include \f[CB]SourceFile\f[R], \f[CB]LineNumberTable\f[R], |
| \f[CB]LocalVariableTable\f[R] and \f[CB]LocalVariableTypeTable\f[R]. |
| Removing these attributes reduces the size of both downloads and |
| installations, also reduces the usefulness of debuggers. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-\-keep\-file\-order\f[R] |
| Preserves the order of files in the input file. |
| This is the default behavior. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-O\f[R] or\f[CB]\-\-no\-keep\-file\-order\f[R] |
| Reorders and transmits all elements. |
| The packer can also remove JAR directory names to reduce the download |
| size. |
| However, certain JAR file optimizations, such as indexing, might not |
| work correctly. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-S\f[R]\f[I]N\f[R] or \f[CB]\-\-segment\-limit=\f[R]\f[I]N\f[R] |
| The value is the estimated target size \f[I]N\f[R] (in bytes) of each |
| archive segment. |
| If a single input file requires more than \f[I]N\f[R] bytes, then its own |
| archive segment is provided. |
| As a special case, a value of \f[CB]\-1\f[R] produces a single large |
| segment with all input files, while a value of 0 produces one segment |
| for each class. |
| Larger archive segments result in less fragmentation and better |
| compression, but processing them requires more memory. |
| .RS |
| .PP |
| The size of each segment is estimated by counting the size of each input |
| file to be transmitted in the segment with the size of its name and |
| other transmitted properties. |
| .PP |
| The default is \f[CB]\-1\f[R], which means that the packer creates a |
| single segment output file. |
| In cases where extremely large output files are generated, users are |
| strongly encouraged to use segmenting or break up the input file into |
| smaller JAR file. |
| .PP |
| A 10 MB JAR packed without this limit typically packs about 10 percent |
| smaller, but the packer might require a larger Java heap (about 10 times |
| the segment limit). |
| .RE |
| .TP |
| .B \f[CB]\-E\f[R]\f[I]value\f[R] or \f[CB]\-\-effort=\f[R]\f[I]value\f[R] |
| If the value is set to a single decimal digit, then the packer uses the |
| indicated amount of effort in compressing the archive. |
| Level 1 might produce somewhat larger size and faster compression speed, |
| while level 9 takes much longer, but can produce better compression. |
| The special value 0 instructs the \f[CB]pack200\f[R] command to copy |
| through the original JAR file directly with no compression. |
| The JSR 200 standard requires any unpacker to understand this special |
| case as a pass\-through of the entire archive. |
| .RS |
| .PP |
| The default is 5, to invest a modest amount of time to produce |
| reasonable compression. |
| .RE |
| .TP |
| .B \f[CB]\-H\f[R]\f[I]value\f[R] or \f[CB]\-\-deflate\-hint=\f[R]\f[I]value\f[R] |
| Overrides the default, which preserves the input information, but can |
| cause the transmitted archive to be larger. |
| The possible values are: \f[CB]true\f[R], \f[CB]false\f[R], or |
| \f[CB]keep\f[R]. |
| .RS |
| .PP |
| If the \f[CB]value\f[R] is \f[CB]true\f[R] or false, then the |
| \f[CB]packer200\f[R] command sets the deflation hint accordingly in the |
| output archive and doesn\[aq]t transmit the individual deflation hints |
| of archive elements. |
| .PP |
| The \f[CB]keep\f[R] value preserves deflation hints observed in the input |
| JAR. |
| This is the default. |
| .RE |
| .TP |
| .B \f[CB]\-m\f[R]\f[I]value\f[R] or \f[CB]\-\-modification\-time=\f[R]\f[I]value\f[R] |
| The possible values are \f[CB]latest\f[R] and \f[CB]keep\f[R]. |
| .RS |
| .PP |
| If the value is \f[CB]latest\f[R], then the packer attempts to determine |
| the latest modification time, among all the available entries in the |
| original archive, or the latest modification time of all the available |
| entries in that segment. |
| This single value is transmitted as part of the segment and applied to |
| all the entries in each segment. |
| This can marginally decrease the transmitted size of the archive at the |
| expense of setting all installed files to a single date. |
| .PP |
| If the value is \f[CB]keep\f[R], then modification times observed in the |
| input JAR are preserved. |
| This is the default. |
| .RE |
| .TP |
| .B \f[CB]\-P\f[R]\f[I]file\f[R] or \f[CB]\-\-pass\-file=\f[R]\f[I]file\f[R] |
| Indicates that a file should be passed through bytewise with no |
| compression. |
| By repeating the option, multiple files can be specified. |
| There is no path name transformation, except that the system file |
| separator is replaced by the JAR file separator forward slash (/). |
| The resulting file names must match exactly as strings with their |
| occurrences in the JAR file. |
| If \f[I]file\f[R] is a directory name, then all files under that |
| directory are passed. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-U\f[R]\f[I]action\f[R] or \f[CB]\-\-unknown\-attribute=\f[R]\f[I]action\f[R] |
| Overrides the default behavior, which means that the class file that |
| contains the unknown attribute is passed through with the specified |
| \f[I]action\f[R]. |
| The possible values for actions are \f[CB]error\f[R], \f[CB]strip\f[R], or |
| \f[CB]pass\f[R]. |
| .RS |
| .PP |
| If the value is \f[CB]error\f[R], then the entire \f[CB]pack200\f[R] command |
| operation fails with a suitable explanation. |
| .PP |
| If the value is \f[CB]strip\f[R], then the attribute is dropped. |
| Removing the required Java Virtual Machine (JVM) attributes can cause |
| class loader failures. |
| .PP |
| If the value is \f[CB]pass\f[R], then the entire class is transmitted as |
| though it is a resource. |
| .RE |
| .TP |
| .B \f[CB]\-C\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R] or \f[CB]\-\-class\-attribute=\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R] |
| (user\-defined attribute) See the description for |
| \f[CB]\-D\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R]. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-F\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R] or \f[CB]\-\-field\-attribute=\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R] |
| (user\-defined attribute) See the description for |
| \f[CB]\-D\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R]. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-M\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R] or \f[CB]\-\-method\-attribute=\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R] |
| (user\-defined attribute) See the description for |
| \f[CB]\-D\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R]. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-D\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R] or \f[CB]\-\-code\-attribute=\f[R]\f[I]attribute\-name\f[R]\f[CB]=\f[R]\f[I]layout\f[R] |
| (user\-defined attribute) The attribute layout can be specified for a |
| class entity, such as \f[CB]class\-attribute\f[R], |
| \f[CB]field\-attribute\f[R], \f[CB]method\-attribute\f[R], and |
| \f[CB]code\-attribute\f[R]. |
| The \f[I]attribute\-name\f[R] is the name of the attribute for which the |
| layout or action is being defined. |
| The possible values for \f[I]action\f[R] are |
| \f[I]some\-layout\-string\f[R], \f[CB]error\f[R], \f[CB]strip\f[R], |
| \f[CB]pass\f[R]. |
| .RS |
| .PP |
| \f[I]some\-layout\-string\f[R]: The layout language is defined in the JSR |
| 200 specification, for example: |
| \f[CB]\-\-class\-attribute=SourceFile=RUH\f[R]. |
| .PP |
| If the value is \f[CB]error\f[R], then the \f[CB]pack200\f[R] operation |
| fails with an explanation. |
| .PP |
| If the value is \f[CB]strip\f[R], then the attribute is removed from the |
| output. |
| Removing JVM\-required attributes can cause class loader failures. |
| For example, \f[CB]\-\-class\-attribute=CompilationID=pass\f[R] causes the |
| class file that contains this attribute to be passed through without |
| further action by the packer. |
| .PP |
| If the value is \f[CB]pass\f[R], then the entire class is transmitted as |
| though it\[aq]s a resource. |
| .RE |
| .TP |
| .B \f[CB]\-f\f[R]\f[I]pack.properties\f[R] or \f[CB]\-\-config\-file=\f[R]\f[I]pack.properties\f[R] |
| Indicates a configuration file, containing Java properties to initialize |
| the packer, can be specified on the command line. |
| .RS |
| .IP |
| .nf |
| \f[CB] |
| pack200\ \-f\ pack.properties\ myarchive.pack.gz\ myarchive.jar |
| more\ pack.properties |
| #\ Generic\ properties\ for\ the\ packer. |
| modification.time=latest |
| deflate.hint=false |
| keep.file.order=false |
| #\ This\ option\ will\ cause\ the\ files\ bearing\ new\ attributes\ to |
| #\ be\ reported\ as\ an\ error\ rather\ than\ passed\ uncompressed. |
| unknown.attribute=error |
| #\ Change\ the\ segment\ limit\ to\ be\ unlimited. |
| segment.limit=\-1 |
| \f[R] |
| .fi |
| .RE |
| .TP |
| .B \f[CB]\-v\f[R] or \f[CB]\-\-verbose\f[R] |
| Outputs minimal messages. |
| Multiple specification of this option will create more verbose messages. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-q\f[R] or \f[CB]\-\-quiet\f[R] |
| Specifies quiet operation with no messages. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-l\f[R]\f[I]filename\f[R] or \f[CB]\-\-log\-file=\f[R]\f[I]filename\f[R] |
| Specifies a log file to output messages. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-?\f[R], \f[CB]\-h\f[R], or\f[CB]\-\-help\f[R] |
| Prints help information about this command. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-V\f[R] or \f[CB]\-\-version\f[R] |
| Prints version information about this command. |
| .RS |
| .RE |
| .TP |
| .B \f[CB]\-J\f[R]\f[I]option\f[R] |
| Passes the specified \f[I]option\f[R] to the Java Virtual Machine. |
| For example, \f[CB]\-J\-Xms48m\f[R] sets the startup memory to 48 MB. |
| .RS |
| .RE |