1PACK200(1) JDK Commands PACK200(1)
2
3
4
6 pack200 - transform a Java Archive (JAR) file into a compressed pack200
7 file with the Java gzip compressor
8
10 pack200 [-opt... | --option=value] x.pack[.gz] JAR-file
11
12 -opt... | --option=value
13 Options can be in any order. The last option on the command
14 line or in a properties file supersedes all previously specified
15 options. See Options for the pack200 Command.
16
17 x.pack[.gz]
18 Name of the output file.
19
20 JAR-file
21 Name of the input file.
22
24 The pack200 command is a Java application that transforms a JAR file
25 into a compressed pack200 file with the Java gzip compressor. This
26 command packages a JAR file into a compressed pack200 file for web de‐
27 ployment. The pack200 files are highly compressed files that can be
28 directly deployed to save bandwidth and reduce download time.
29
30 Typical usage is shown in the following example, where
31 myarchive.pack.gz is produced with the default pack200 command set‐
32 tings:
33
34 pack200 myarchive.pack.gz myarchive.jar
35
36 Note:
37
38 This command shouldn't be confused with pack. The pack and pack200
39 commands are separate products. The Java SE API Specification provided
40 with the JDK is the superseding authority, when there are discrepan‐
41 cies.
42
44 The following exit values are returned: 0 for successful completion and
45 a number greater than 0 when an error occurs.
46
48 The pack200 command has several options to fine-tune and set the com‐
49 pression engine. The typical usage is shown in the following example,
50 where myarchive.pack.gz is produced with the default pack200 command
51 settings:
52
53 pack200 myarchive.pack.gz myarchive.jar
54
55 -r or --repack
56 Produces a JAR file by packing and unpacking a JAR file. The
57 resulting file can be used as an input to the jarsigner tool.
58 The following example packs and unpacks the myarchive.jar file:
59
60 pack200 --repack myarchive-packer.jar myarchive.jar
61
62 pack200 --repack myarchive.jar
63
64 -g or--no-gzip
65 Produces a pack200 file. With this option, a suitable compres‐
66 sor must be used, and the target system must use a corresponding
67 decompresser.
68
69 pack200 --no-gzip myarchive.pack myarchive.jar
70
71 --gzip (Default) Post-compresses the pack output with gzip.
72
73 -G or --strip-debug
74 Strips debugging attributes from the output. These include
75 SourceFile, LineNumberTable, LocalVariableTable and LocalVari‐
76 ableTypeTable. Removing these attributes reduces the size of
77 both downloads and installations, also reduces the usefulness of
78 debuggers.
79
80 --keep-file-order
81 Preserves the order of files in the input file. This is the de‐
82 fault behavior.
83
84 -O or--no-keep-file-order
85 Reorders and transmits all elements. The packer can also remove
86 JAR directory names to reduce the download size. However, cer‐
87 tain JAR file optimizations, such as indexing, might not work
88 correctly.
89
90 -SN or --segment-limit=N
91 The value is the estimated target size N (in bytes) of each ar‐
92 chive segment. If a single input file requires more than N
93 bytes, then its own archive segment is provided. As a special
94 case, a value of -1 produces a single large segment with all in‐
95 put files, while a value of 0 produces one segment for each
96 class. Larger archive segments result in less fragmentation and
97 better compression, but processing them requires more memory.
98
99 The size of each segment is estimated by counting the size of
100 each input file to be transmitted in the segment with the size
101 of its name and other transmitted properties.
102
103 The default is -1, which means that the packer creates a single
104 segment output file. In cases where extremely large output
105 files are generated, users are strongly encouraged to use seg‐
106 menting or break up the input file into smaller JAR file.
107
108 A 10 MB JAR packed without this limit typically packs about 10
109 percent smaller, but the packer might require a larger Java heap
110 (about 10 times the segment limit).
111
112 -Evalue or --effort=value
113 If the value is set to a single decimal digit, then the packer
114 uses the indicated amount of effort in compressing the archive.
115 Level 1 might produce somewhat larger size and faster compres‐
116 sion speed, while level 9 takes much longer, but can produce
117 better compression. The special value 0 instructs the pack200
118 command to copy through the original JAR file directly with no
119 compression. The JSR 200 standard requires any unpacker to un‐
120 derstand this special case as a pass-through of the entire ar‐
121 chive.
122
123 The default is 5, to invest a modest amount of time to produce
124 reasonable compression.
125
126 -Hvalue or --deflate-hint=value
127 Overrides the default, which preserves the input information,
128 but can cause the transmitted archive to be larger. The possi‐
129 ble values are: true, false, or keep.
130
131 If the value is true or false, then the packer200 command sets
132 the deflation hint accordingly in the output archive and doesn't
133 transmit the individual deflation hints of archive elements.
134
135 The keep value preserves deflation hints observed in the input
136 JAR. This is the default.
137
138 -mvalue or --modification-time=value
139 The possible values are latest and keep.
140
141 If the value is latest, then the packer attempts to determine
142 the latest modification time, among all the available entries in
143 the original archive, or the latest modification time of all the
144 available entries in that segment. This single value is trans‐
145 mitted as part of the segment and applied to all the entries in
146 each segment. This can marginally decrease the transmitted size
147 of the archive at the expense of setting all installed files to
148 a single date.
149
150 If the value is keep, then modification times observed in the
151 input JAR are preserved. This is the default.
152
153 -Pfile or --pass-file=file
154 Indicates that a file should be passed through bytewise with no
155 compression. By repeating the option, multiple files can be
156 specified. There is no path name transformation, except that
157 the system file separator is replaced by the JAR file separator
158 forward slash (/). The resulting file names must match exactly
159 as strings with their occurrences in the JAR file. If file is a
160 directory name, then all files under that directory are passed.
161
162 -Uaction or --unknown-attribute=action
163 Overrides the default behavior, which means that the class file
164 that contains the unknown attribute is passed through with the
165 specified action. The possible values for actions are error,
166 strip, or pass.
167
168 If the value is error, then the entire pack200 command operation
169 fails with a suitable explanation.
170
171 If the value is strip, then the attribute is dropped. Removing
172 the required Java Virtual Machine (JVM) attributes can cause
173 class loader failures.
174
175 If the value is pass, then the entire class is transmitted as
176 though it is a resource.
177
178 -Cattribute-name=layout or --class-attribute=attribute-name=layout
179 (user-defined attribute) See the description for -Dat‐
180 tribute-name=layout.
181
182 -Fattribute-name=layout or --field-attribute=attribute-name=layout
183 (user-defined attribute) See the description for -Dat‐
184 tribute-name=layout.
185
186 -Mattribute-name=layout or --method-attribute=attribute-name=layout
187 (user-defined attribute) See the description for -Dat‐
188 tribute-name=layout.
189
190 -Dattribute-name=layout or --code-attribute=attribute-name=layout
191 (user-defined attribute) The attribute layout can be specified
192 for a class entity, such as class-attribute, field-attribute,
193 method-attribute, and code-attribute. The attribute-name is the
194 name of the attribute for which the layout or action is being
195 defined. The possible values for action are some-layout-string,
196 error, strip, pass.
197
198 some-layout-string: The layout language is defined in the JSR
199 200 specification, for example: --class-attribute=Source‐
200 File=RUH.
201
202 If the value is error, then the pack200 operation fails with an
203 explanation.
204
205 If the value is strip, then the attribute is removed from the
206 output. Removing JVM-required attributes can cause class loader
207 failures. For example, --class-attribute=CompilationID=pass
208 causes the class file that contains this attribute to be passed
209 through without further action by the packer.
210
211 If the value is pass, then the entire class is transmitted as
212 though it's a resource.
213
214 -fpack.properties or --config-file=pack.properties
215 Indicates a configuration file, containing Java properties to
216 initialize the packer, can be specified on the command line.
217
218 pack200 -f pack.properties myarchive.pack.gz myarchive.jar
219 more pack.properties
220 # Generic properties for the packer.
221 modification.time=latest
222 deflate.hint=false
223 keep.file.order=false
224 # This option will cause the files bearing new attributes to
225 # be reported as an error rather than passed uncompressed.
226 unknown.attribute=error
227 # Change the segment limit to be unlimited.
228 segment.limit=-1
229
230 -v or --verbose
231 Outputs minimal messages. Multiple specification of this option
232 will create more verbose messages.
233
234 -q or --quiet
235 Specifies quiet operation with no messages.
236
237 -lfilename or --log-file=filename
238 Specifies a log file to output messages.
239
240 -?, -h, or--help
241 Prints help information about this command.
242
243 -V or --version
244 Prints version information about this command.
245
246 -Joption
247 Passes the specified option to the Java Virtual Machine. For
248 example, -J-Xms48m sets the startup memory to 48 MB.
249
250
251
252JDK 13 2018 PACK200(1)