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