Java Reference
In-Depth Information
on a Windows platform or
$ java -cp MyApp.jar:MyHelp.jar:MyUtilities.jar MyApp
on a Unix or Linux platform (using the Unix standard directory separator “:”).
5.6.3 The
pack200
tool in J2SE 5.0
Release 5.0 of Java includes a new hyper-compression format for JAR files known
as
pack200
.Itworks only on JAR files and is able to compress the size as much
as 90% for very dense JAR files. The
pack200
format is well-suited for slow
networks and fast computers or for very large JAR files. For example, use of
the
pack200
format is estimated to save 12 terabytes per week of downloads
at
http://java.sun.com
. The
pack200
tool creates a
.pack
file and the
unpack200
tool unpacks a
.pack
file into a JAR file. Both tools accept several
options, but here is a quick example of usage:
pack200 - g name.pack name.jar
creates the highly compressed
name.pack
file from the
name.jar
file. Con-
versely,
unpack200 name.pack name.jar
unpacks the packed file into a JAR file.
5.7 Distributing Java code
The Java design allows for relatively easy sharing and maintenance of code. Java
is a so-called late-binding object language, which means that it does not load class
definitions until they are needed during the execution of the program. So you do
not need to recompile classes that access or subclass any classes that have been
altered and recompiled by their authors, assuming the alterations don't change
the accessible method signatures and fields.
Java classes should normally be distributed in a package and, especially if the
code is large, in a JAR file. As an example of Java code distribution, we can look at
the JDK installation on Windows. It creates a set of directories and subdirectories
like the following:
jdk1.5.0
____________|_______
| | | | |
bin lib | demo |
| jre
| __|__
include | |
bin lib
(The
default
for
the
installer
is
to
put
this
under
the
c:
\
Program
Files
\
Java
\
directory.) The
bin
directory contains the set of Java tools, such
Search WWH ::
Custom Search