Start of Tutorial > Start of Trail > Start of Lesson | Search |
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>
Start of Tutorial > Start of Trail > Start of Lesson | Search |