1pack200(1) General Commands Manual pack200(1)
2
3
4
6 pack200 - JAR Packing tool
7
9 pack200 [ options ] output-file JAR-file
10
11 Options may be in any order. The last option on the command line or in
12 a properties file supersedes all previously specified options.
13
14 options
15 Command-line options.
16
17 output-file
18 Name of the output file.
19
20 JAR-file
21 Name of the input file.
22
23
25 The pack200 tool is a Java application that transforms a JAR file into
26 a compressed pack200 file using the Java gzip compressor. The pack200
27 files are highly compressed files that can be directly deployed, saving
28 bandwidth and reducing download time.
29
30 The pack200 tool uses several options to fine-tune and set the compres‐
31 sion engine.
32
33 Typical usage:
34 % pack200 myarchive.pack.gz myarchive.jar
35
36 In this example, myarchive.pack.gz is produced using the default
37 pack200 settings.
38
40 -r --repack
41
42 Produces a JAR file by packing the file myarchive.jar and unpacking it.
43 The resulting file can be used as an input to the jarsigner(1) tool.
44
45 % pack200 --repack myarchive-packer.jar myarchive.jar
46
47 % pack200 --repack myarchive.jar
48
49 -g --no-gzip
50
51 Produces a pack200 file. With this option a suitable compressor must be
52 used, and the target system must use a corresponding decompresser.
53
54 % pack200 --no-gzip myarchive.pack myarchive.jar
55
56 -G --strip-debug
57
58 Strips attributes used for debugging from the output. These include
59 SourceFile, LineNumberTable, LocalVariableTable and LocalVariableType‐
60 Table. Removing these attributes reduces the size of both downloads and
61 installations but reduces the usefulness of debuggers.
62
63 --keep-file-order
64
65 Preserve the order of files in the input file; this is the default
66 behavior.
67
68 -O --no-keep-file-order
69
70 The packer will reorder and transmit all elements. Additionally, the
71 packer may remove JAR directory names. This will reduce the download
72 size; however, certain JAR file optimizations, such as indexing, may
73 not work correctly.
74
75 -Svalue --segment-limit=value
76
77 The value is the estimated target size N (in bytes) of each archive
78 segment. If a single input file requires
79 more than N bytes, it will be given its own archive segment. As a spe‐
80 cial case, a value of -1 will produce a single large segment with all
81 input files, while a value of 0 will produce one segment for each
82 class. Larger archive segments result in less fragmentation and better
83 compression, but processing them requires more memory.
84
85 The size of each segment is estimated by counting the size of each
86 input file to be transmitted in the segment, along with the size of its
87 name and other transmitted properties.
88
89 The default is -1, which means the packer will always create a single
90 segment output file. In cases where extremely large output files are
91 generated, users are strongly encouraged to use segmenting or break up
92 the input file into smaller JARs.
93
94 A 10MB JAR packed without this limit will typically pack about 10%
95 smaller, but the packer may require a larger Java heap (about ten times
96 the segment limit).
97
98 -Evalue --effort=value
99
100 If the value is set to a single decimal digit, the packer will use the
101 indicated amount of effort in compressing the archive. Level 1 may pro‐
102 duce somewhat larger size and faster compression speed, while level 9
103 will take much longer but may produce better compression. The special
104 value 0 instructs the packer to copy through the original JAR file
105 directly with no compression. The JSR 200 standard requires any
106 unpacker to understand this special case as a pass-through of the
107 entire archive.
108
109 The default is 5, investing a modest amount of time to produce reason‐
110 able compression.
111
112 -Hvalue --deflate-hint=value
113
114 Overrides the default, which preserves the input information, but may
115 cause the transmitted archive to be larger. The possible values are:
116
117 true
118
119 false
120 In either case, the packer will set the deflation hint accord‐
121 ingly in the output archive, and will not transmit the individual
122 deflation hints of archive elements.
123
124
125 keep
126 Preserve deflation hints observed in the input JAR. (This is the
127 default.)
128
129
130 -mvalue --modification-time=value
131
132 The possible values are:
133
134 latest
135 The packer will attempt to determine the latest modification
136 time, among all the available entries in the original archive, or
137 the latest modification time of all the available entries in that
138 segment. This single value will be transmitted as part of the
139 segment and applied to all the entries in each segment. This can
140 marginally decrease the transmitted size of the archive at the
141 expense of setting all installed files to a single date.
142
143 keep
144 Preserves modification times observed in the input JAR. (This is
145 the default.)
146
147
148 -Pfile --pass-file=file
149
150 Indicates that a file should be passed through bytewise with no com‐
151 pression. By repeating the option, multiple files may be specified.
152 There is no pathname transformation, except that the system file sepa‐
153 rator is replaced by the JAR file separator "/". The resulting file
154 names must match exactly as strings with their occurrences in the JAR
155 file. If file is a directory name, all files under that directory will
156 be passed.
157
158 -Uaction --unknown-attribute=action
159
160 Overrides the default behavior; i.e., the classfile containing the
161 unknown attribute will be passed through with the specified action. The
162 possible values for actions are:
163
164 error
165 The pack200 operation as a whole will fail with a suitable expla‐
166 nation.
167
168 strip
169 The attribute will be dropped. Note: Removing the required VM
170 attributes may cause Class Loader failures.
171
172 pass
173 Upon encountering this attribute, the entire class will be trans‐
174 mitted as though it is a resource.
175
176
177 -Cattribute-name=layout --class-attribute=attribute-name=action
178 -Fattribute-name=layout --field-attribute=attribute-name=action
179 -Mattribute-name=layout --method-attribute=attribute-name=action
180 -Dattribute-name=layout --code-attribute=attribute-name=action
181
182 With the above four options, the attribute layout can be specified for
183 a class entity, such as Class attribute, Field attribute, Method
184 attribute, and Code attribute. The attribute-name is the name of the
185 attribute for which the layout or action is being defined. The possible
186 values for action are:
187
188 some-layout-string
189 The layout language is defined in the JSR 200 specification.
190
191 Example: --class-attribute=SourceFile=RUH
192
193 error
194 Upon encountering this attribute, the pack200 operation will fail
195 with a suitable explanation.
196
197 strip
198 Upon encountering this attribute, the attribute will be removed
199 from the output. Note: removing VM-required attributes may cause
200 Class Loader failures.
201
202
203 Example: --class-attribute=CompilationID=pass will cause the class file
204 containing this attribute to be passed through without further action
205 by the packer.
206
207 -f pack.properties --config-file=pack.properties
208
209 A configuration file, containing Java properties to initialize the
210 packer, may be specified on the command line.
211
212 % pack200 -f pack.properties myarchive.pack.gz myarchive.jar
213 % more pack.properties
214 # Generic properties for the packer.
215 modification.time=latest
216 deflate.hint=false
217 keep.file.order=false
218 # This option will cause the files bearing new attributes to
219 # be reported as an error rather than passed uncompressed.
220 unknown.attribute=error
221 # Change the segment limit to be unlimited.
222 segment.limit=-1
223
224 -v --verbose
225
226 Outputs minimal messages. Multiple specification of this option will
227 output more verbose messages.
228
229 -q --quiet
230
231 Specifies quiet operation with no messages.
232
233 -lfilename --log-file=filename
234
235 Specifies a log file to output messages.
236
237 -? -h --help
238
239 Prints help information about this command.
240
241 -V --version
242
243 Prints version information about this command.
244
245 -Joption
246
247 Passes option to the Java launcher called by pack200. For example,
248 -J-Xms48m sets the startup memory to 48 megabytes. Although it does not
249 begin with -X, it is not a standard option of pack200. It is a common
250 convention for -J to pass options to the underlying VM executing appli‐
251 cations written in Java.
252
254 The following exit values are returned:
255
256 0 for successful completion;
257
258 >0 if an error occurs.
259
261 o unpack200(1)
262
263 o Java SE Documentation @
264 http://docs.oracle.com/javase/7/docs/index.html
265
266 o Java Deployment Guide - Pack200 @
267 http://docs.oracle.com/javase/7/docs/technotes/guides/deploy‐
268 ment/deployment-guide/pack200.html
269
270 o jar(1) - Java Archive Tool
271
272 o jarsigner(1) - JAR Signer tool
273
274 o attributes(5) man page
275
276
278 This command should not be confused with pack(1). They are distinctly
279 separate products.
280
281 The Java SE API Specification provided with the JDK is the superseding
282 authority, in case of discrepancies.
283
284 16 Mar 2012 pack200(1)