Appendix C. JAR

The jar command-line tool is used to create Java Archives, or JAR files. A JAR contains other files, which may be compressed using the popular ZIP format. The jar tool is used to create and modify JARs.

JAR files will someday improve the speed of downloading applets over the network. You can stick all the files an applet needs into a JAR. This offers two speed advantages:

  • The client needs to download only one JAR, instead of the many individual files that make up the applet. Applets are typically composed of a number of small class, graphics, and audio files. The cost of setting up a separate network connection for each one is high. Downloading a single, larger file is faster.

  • Some of the files in the JAR may be compressed, which makes the download a little faster. Of course, it takes a little time to decompress the files, but bandwidth is clearly the time drain du jour.

Currently, only the appletviewer tool and HotJava recognize JAR files containing applets. The major browser vendors are expected to follow suit soon.

A JAR file can be signed, using javakey in JDK 1.1, or jarsigner in JDK 1.2.

Get Java Cryptography now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.