pack200.1 10.9 KB
Newer Older
1
." Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
." 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.
."
18 19 20
." 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.
T
tbell 已提交
21
."
22
.TH pack200 1 "02 Jun 2010"
D
duke 已提交
23 24

.LP
T
tbell 已提交
25
.SH "Name"
D
duke 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
pack200 \- JAR Packing tool
.LP
.SH "SYNOPSIS"
.LP

.LP
.LP
\f4pack200\fP\f2 [ \fP\f2options\fP ] \f2output\-file\fP \f2JAR\-file\fP
.LP
.LP
Options may be in any order. The last option on the command line or in a properties file supersedes all previously specified options.
.LP
.RS 3

.LP
T
tbell 已提交
41
.RS 3
D
duke 已提交
42 43 44 45 46 47 48 49 50
.TP 3
options 
Command\-line options. 
.TP 3
output\-file 
Name of the output file. 
.TP 3
JAR\-file 
Name of the input file. 
T
tbell 已提交
51 52
.RE

D
duke 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
.LP
.RE
.SH "DESCRIPTION"
.LP

.LP
.LP
The \f2pack200\fP tool is a Java application that transforms a JAR file into a compressed \f2pack200\fP file using the Java \f2gzip\fP compressor. The \f2pack200\fP files are highly compressed files that can be directly deployed, saving bandwidth and reducing download time.
.LP
.LP
The \f2pack200\fP tool uses several options to fine\-tune and set the compression engine.
.LP
.SS 
Typical usage:
.LP
T
tbell 已提交
68
.RS 3
D
duke 已提交
69 70 71 72 73

.LP
.LP
\f2% pack200 myarchive.pack.gz myarchive.jar\fP
.LP
T
tbell 已提交
74
.RE
D
duke 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
.LP
In this example, \f2myarchive.pack.gz\fP is produced using the default \f2pack200\fP settings.
.LP
.SH "OPTIONS"
.LP

.LP
.LP
\f4\-r \-\-repack\fP
.LP
.RS 3

.LP
.LP
Produces a JAR file by packing the file \f2myarchive.jar\fP and unpacking it. The resulting file can be used as an input to the \f2jarsigner(1)\fP tool.
.LP
.RS 3

.LP
.LP
\f2% pack200 \-\-repack myarchive\-packer.jar myarchive.jar\fP
.LP
.LP
\f2% pack200 \-\-repack myarchive.jar\fP
.LP
.RE
.RE
.LP
\f4\-g \-\-no\-gzip\fP
.LP
.RS 3

.LP
.LP
Produces a \f2pack200\fP file. With this option a suitable compressor must be used, and the target system must use a corresponding decompresser.
.LP
.RS 3

.LP
.LP
\f2% pack200 \-\-no\-gzip myarchive.pack myarchive.jar\fP
.LP
.RE
.RE
.LP
\f4\-G \-\-strip\-debug\fP
.LP
.RS 3

.LP
.LP
Strips attributes used for debugging from the output. These include \f2SourceFile\fP, \f2LineNumberTable\fP, \f2LocalVariableTable\fP and \f2LocalVariableTypeTable\fP. Removing these attributes reduces the size of both downloads and installations but reduces the usefulness of debuggers.
.LP
.RE
.LP
\f4\-O \-\-no\-keep\-file\-order\fP
.LP
.RS 3

.LP
.LP
The packer will reorder and transmit all elements. Additionally, the packer may remove JAR directory names. This will reduce the download size; however, certain JAR file optimizations, such as indexing, may not work correctly.
.LP
.RE
.LP
\f4\-Svalue \-\-segment\-limit=\fP\f2value\fP
.LP
.RS 3

.LP
.LP
The value is the estimated target size N (in bytes) of each archive segment. If a single input file requires
.br
more than N bytes, it will be given its own archive segment. As a special case, a value of \f2\-1\fP will produce a single large segment with all input files, while a value of \f20\fP will produce one segment for each class. Larger archive segments result in less fragmentation and better compression, but processing them requires more memory.
.LP
.LP
The size of each segment is estimated by counting the size of each input file to be transmitted in the segment, along with the size of its name and other transmitted properties.
.LP
.LP
The default is \f21000000\fP (a million bytes). This allows input JAR files of moderate size to be transmitted in one segment. It also puts a limit on memory requirements for packers and unpackers.
.LP
.LP
A 10MB JAR packed without this limit will typically pack about 10% smaller, but the packer may require a larger Java heap (about ten times the segment limit).
.LP
.RE
.LP
\f4\-Evalue \-\-effort=\fP\f2value\fP
.LP
.RS 3

.LP
.LP
If the value is set to a single decimal digit, the packer will use the indicated amount of effort in compressing the archive. Level \f21\fP may produce somewhat larger size and faster compression speed, while level \f29\fP will take much longer but may produce better compression. The special value \f20\fP instructs the packer 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.
.LP
.LP
The default is \f25\fP, investing a modest amount of time to produce reasonable compression.
.LP
.RE
.LP
\f4\-Hvalue \-\-deflate\-hint=\fP\f2value\fP
.LP
.RS 3

.LP
.LP
Overrides the default, which preserves the input information, but may cause the transmitted archive to be larger. The possible values are:
.LP
T
tbell 已提交
182
.RS 3
D
duke 已提交
183 184 185 186 187
.TP 3
true 
.TP 3
false 
In either case, the packer will set the deflation hint accordingly in the output archive, and will not transmit the individual deflation hints of archive elements. 
T
tbell 已提交
188 189
.RE

D
duke 已提交
190
.LP
T
tbell 已提交
191
.RS 3
D
duke 已提交
192 193 194
.TP 3
keep 
Preserve deflation hints observed in the input JAR. (This is the default.) 
T
tbell 已提交
195 196
.RE

D
duke 已提交
197 198 199 200 201 202 203 204 205 206 207
.LP
.RE
.LP
\f4\-mvalue \-\-modification\-time=\fP\f2value\fP
.LP
.RS 3

.LP
.LP
The possible values are:
.LP
T
tbell 已提交
208
.RS 3
D
duke 已提交
209 210 211 212 213 214
.TP 3
latest 
The packer will attempt 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 will be 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. 
.TP 3
keep 
Preserves modification times observed in the input JAR. (This is the default.) 
T
tbell 已提交
215 216
.RE

D
duke 已提交
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
.LP
.RE
.LP
\f4\-Pfile \-\-pass\-file=\fP\f2file\fP
.LP
.RS 3

.LP
.LP
Indicates that a file should be passed through bytewise with no compression. By repeating the option, multiple files may be specified. There is no pathname transformation, except that the system file separator is replaced by the JAR file separator "\f2/\fP". The resulting file names must match exactly as strings with their occurrences in the JAR file. If file is a directory name, all files under that directory will be passed.
.LP
.RE
.LP
\f4\-Uaction \-\-unknown\-attribute=\fP\f2action\fP
.LP
.RS 3

.LP
.LP
Overrides the default behavior; i.e., the classfile containing the unknown attribute will be passed through with the specified action. The possible values for actions are:
.LP
T
tbell 已提交
238
.RS 3
D
duke 已提交
239 240 241 242 243 244 245 246 247
.TP 3
error 
The \f2pack200\fP operation as a whole will fail with a suitable explanation. 
.TP 3
strip 
The attribute will be dropped. Note: Removing the required VM attributes may cause Class Loader failures. 
.TP 3
pass 
Upon encountering this attribute, the entire class will be transmitted as though it is a resource. 
T
tbell 已提交
248 249
.RE

D
duke 已提交
250 251 252 253 254
.LP
.RE
.LP
\f4\-Cattribute\-name=\fP\f2layout\fP \f3\-\-class\-attribute=\fP\f2attribute\-name=action\fP
.br
T
tbell 已提交
255
\f4\-Fattribute\-name=\fP\f2layout\fP \f3\-\-field\-attribute=\fP\f2attribute\-name=action\fP
D
duke 已提交
256
.br
T
tbell 已提交
257
\f4\-Mattribute\-name=\fP\f2layout\fP \f3\-\-method\-attribute=\fP\f2attribute\-name=action\fP
D
duke 已提交
258
.br
T
tbell 已提交
259
\f4\-Dattribute\-name=\fP\f2layout\fP \f3\-\-code\-attribute=\fP\f2attribute\-name=action\fP
D
duke 已提交
260 261 262 263 264 265 266
.LP
.RS 3

.LP
.LP
With the above four options, the attribute layout can be specified for a class entity, such as Class attribute, Field attribute, Method attribute, and Code attribute. The attribute\-name is the name of the attribute for which the layout or action is being defined. The possible values for action are:
.LP
T
tbell 已提交
267
.RS 3
D
duke 已提交
268 269 270 271 272 273 274 275 276 277 278
.TP 3
some\-layout\-string 
The layout language is defined in the JSR 200 specification. 
.LP
Example: \f2\-\-class\-attribute=SourceFile=RUH\fP  
.TP 3
error 
Upon encountering this attribute, the pack200 operation will fail with a suitable explanation. 
.TP 3
strip 
Upon encountering this attribute, the attribute will be removed from the output. Note: removing VM\-required attributes may cause Class Loader failures. 
T
tbell 已提交
279 280
.RE

D
duke 已提交
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
.LP
.LP
Example: \f2\-\-class\-attribute=CompilationID=pass\fP will cause the class file containing this attribute to be passed through without further action by the packer.
.LP
.RE
.LP
\f4\-f\fP\f2 \fP\f2pack.properties\fP \f3\-\-config\-file=\fP\f2pack.properties\fP
.LP
.RS 3

.LP
.LP
A configuration file, containing Java properties to initialize the packer, may be specified on the command line.
.LP
.RS 3

.LP
.LP
\f2% pack200 \-f pack.properties myarchive.pack.gz myarchive.jar\fP
.br
\f2% more pack.properties\fP
.br
\f2# Generic properties for the packer.\fP
.br
\f2modification.time=latest\fP
.br
\f2deflate.hint=false\fP
.br
\f2keep.file.order=false\fP
.br
\f2# This option will cause the files bearing new attributes to\fP
.br
\f2# be reported as an error rather than passed uncompressed.\fP
.br
\f2unknown.attribute=error\fP
.br
\f2# Change the segment limit to be unlimited.\fP
.br
\f2segment.limit=\-1\fP
.LP
.RE
.RE
.RS 3

.LP
.LP
\f4\-v \-\-verbose\fP
.LP
.RS 3

.LP
.LP
Outputs minimal messages. Multiple specification of this option will output more verbose messages.
.LP
.RE
.LP
\f4\-q \-\-quiet\fP
.LP
.RS 3

.LP
.LP
Specifies quiet operation with no messages.
.LP
.RE
.LP
\f4\-lfilename \-\-log\-file=\fP\f2filename\fP
.LP
.RS 3

.LP
.LP
Specifies a log file to output messages.
.LP
.RE
.LP
\f4\-Joption\fP
.LP
.RS 3

.LP
.LP
Passes option to the Java launcher called by \f2pack200\fP. For example, \f2\-J\-Xms48m\fP sets the startup memory to 48 megabytes. Although it does not begin with \f2\-X\fP, it is not a standard option of \f2pack200\fP. It is a common convention for \f2\-J\fP to pass options to the underlying VM executing applications written in Java.
.LP
.RE
.RE
.SH "EXIT STATUS"
.LP

.LP
.LP
The following exit values are returned:
.LP
.RS 3

.LP
.LP
\f2\ 0\fP for successful completion;
.LP
.LP
\f2>0\fP if an error occurs.
.LP
.RE
.SH "SEE ALSO"
.LP
.RS 3
.TP 2
T
tbell 已提交
388 389
o
unpack200(1) 
D
duke 已提交
390
.TP 2
T
tbell 已提交
391 392 393 394 395
o
.na
\f2Java SE Documentation\fP @
.fi
http://java.sun.com/javase/6/docs/index.html 
D
duke 已提交
396
.TP 2
T
tbell 已提交
397
o
D
duke 已提交
398 399 400 401 402
.na
\f2Java Deployment Guide \- Pack200\fP @
.fi
http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment\-guide/pack200.html 
.TP 2
T
tbell 已提交
403 404
o
jar(1) \- Java Archive Tool 
D
duke 已提交
405
.TP 2
T
tbell 已提交
406 407 408 409 410
o
jarsigner(1) \- JAR Signer tool 
.TP 2
o
\f2attributes(5)\fP man page 
D
duke 已提交
411 412 413 414 415 416 417 418 419 420 421
.RE

.LP
.SH "NOTES"
.LP

.LP
.LP
This command should not be confused with \f2pack(1)\fP. They are distinctly separate products.
.LP
.LP
T
tbell 已提交
422 423
The Java SE API Specification provided with the JDK is the superseding authority, in case of discrepancies.
.LP
D
duke 已提交
424