JAR stands for Java ARchive. It's a file format based on the popular ZIP file format and is used for aggregating many files into one. Although JAR can be used as a general archiving tool, the primary motivation for its development was so that Java applets and their requisite components (.class files, images and sounds) can be downloaded to a browser in a single HTTP transaction, rather than opening a new connection for each piece. This greatly improves the speed with which an applet can be loaded onto a web page and begin functioning. The JAR format also supports compression, which reduces the size of the file and improves download time still further. Additionally, individual entries in a JAR file may be digitally signed by the applet author to authenticate their origin.
JAR consists of a zip archive, as defined by PKWARE, containing a manifest file and potentially signature files, as defined in the Manifest and Signature specification.
<applet code=Animator.class width=460 height=160> <param name=archives value="jars/animator.jar"> <param name=foo value="bar"> </applet>Note that the familiar CODE=myApplet.class parameter must still be present. The CODE parameter, as always, identifies the name of the applet where execution begins. However, the class file for the applet and all of its helper classes are loaded from the JAR file.
Once the archive file is identified, it is downloaded and separated into its components. During the execution of the applet, when a new class, image or audio clip is requested by the applet, it is searched for first in the archives associated with the applet. If the file is not found amongst the archives that were downloaded, it is searched for on the applet's server, relative to the CODEBASE (i.e., it is searched for as in JDK1.0.2).
The archives tag may specify multiple JAR files. Each JAR file must be separated by "+" (addition signs). Each file is downloaded in turn:
<applet code=Animator.class width=460 height=160> <param name=ARCHIVES value="classes.jar + images.jar + sounds.jar"> <param name=foo value="bar"> </applet>There can be any amount of white space between entries within the archives parameter. In addition, the archives tag itself is case-insensitive; it can be lower-case, upper-case, or any combination of lower- and upper-case letters, such as ArCHiVes.