The JavaTM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form

Trail: JDK(TM) 1.1 -- And Beyond!
Lesson: 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

Please refer to the trail JAR Files. JAR files are also discussed in Combining an Applet's Files into a Single File, which shows you how to use JAR files with your applets and talks about the benefits of doing so.

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form