| # JavaTM Archive (JAR) Features | Documentation Contents

> JAR (Java Archive) is a platform-independent file format that aggregates many files into one. Multiple Java applets and their requisite components (.class files, images and sounds) can be bundled in a JAR file and subsequently downloaded to a browser in a single HTTP transaction, greatly improving the download speed. The JAR format also supports compression, which reduces the file size, further improving the download time. In addition, the applet author can digitally sign individual entries in a JAR file to authenticate their origin. It is fully backward-compatible with existing applet code and is fully extensible.

> This version of the Java platform extends the utility of the JAR format. Enhancements include added functionality for the command-line JAR tool for creating Jar-file indexes for faster access to Jar-file contents. There are also new standard APIs for a "delete-on-close" mode for opening Jar files.

JAR File Specification and Overview

- JAR File Specification
- JAR File Overview

JAR Files and the Extensions Framework

- The new extensions mechanism in the Java platform uses the JAR file format to package extension classes. Manifest attributes are available to support the extension mechanism and related features such as package sealing and package versioning. See the extensions specification for details.

Enhanced Jar Tool

- The Jar tool has the new `-i` option for creating JAR file indexes. See the Jar tool reference pages:

  > Jar tool reference page for Solaris
  > Jar tool reference page for Windows

Reading and Writing JAR Files: API Specification

- Package java.util.jar: classes for creating and reading JAR files
- Class java.net.JarURLConnection: Abstract class for URL connections to JAR files using the jar protocol.

> The API of classes `java.util.zip` and `java.util.jar` have been enhanced with the addition of the following:
> - java.util.zip.OPEN_READ
> - java.util.zip.OPEN_DELETE
> - java.util.zip.ZipFile(File file, int mode)
> - java.util.jar.JarFile(File file, boolean verify, int mode)
> The previous implementation of caching downloaded Jar files created problems for long-running server application and for RMI. Each open JarURLConnection creates a temporary local file that holds Jar-file date, and a JarFile object is created on top of the temporary file. Because the open file handle/descriptor on each temporary file was never closed, the files could quickly take up disk space for long-running server applications. The new API provides a solution for this problem by supporting a new "delete-on-close" mode for opening Zip and Jar files.

Tutorial

> On the Java Software website:

- The Java Archive (JAR) File Format trail in the Java Tutorial.

Copyright © 1995-99 Sun Microsystems, Inc. All Rights Reserved. | Java Software