Previous | Next | Trail Map | To 1.1 -- And Beyond! | What's New in 1.1?


JAR File Format

JAR (Java ARchive) is a platform-independent file format that allows you to bundle a Java applet and its requisite components (.class files, images and sounds) into a single file. Using the new ARCHIVE attribute of the <APPLET> tag, this JAR file can be downloaded to a browser in a single HTTP transaction, greatly improving the download speed. In addition, JAR supports compression, which reduces the file size, further improving the download time.

Finally, the applet author can digitally sign individual entries in a JAR file to authenticate their origin. You read about this in Security and Signed Applets.

To help you get started, here's a brief introduction to some of the basics of using JAR files. You create and manipulate JAR files with the jar utility program. The command-line arguments to jar are similar to those of the UNIX tar program. Table 19 lists the most common manipulations of a JAR file along with the jar command or HTML tags for doing them.

To create a JAR file: jar cvf JARfilename listoffiles
To list the contents
of a JAR file:
jar tvf JARfilename
To extract the entire
contents of a JAR file:
jar xvf JARfilename
To extract a specific
file from a JAR file:
jar xvf JARfilename FileToExtract
To specify the use of a
JAR file with an applet:
<applet code=AppletClassName.class
        archive="JarFileName.jar"
        width=width height=height>
</applet>

Where to Find Documentation

Currently, the amount of documentation available within the tutorial about JAR files is somewhat limited. However, it's enough to get you going.


Previous | Next | Trail Map | To 1.1 -- And Beyond! | What's New in 1.1?