What's New in 1.1? |
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 newARCHIVE
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.
- Combining an Applet's Files into a Single File shows you how to use JAR files with your applets and talks about the benefits of doing so.
- JAR files are used in a number of the tutorial's applet examples, including the examples in Writing Global Programs and Introduction to the New AWT Event Model.
- You can also read about the JAR Enchancements to come.
- In addition, to the above-mentioned JAR documentation you can find in the tutorial, The JAR Guide and Manifest Format Specification are available at the JAR - Java Archive page.
What's New in 1.1? |