Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Books

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 
Book Excerpts

The Java Archive (JAR) File Format

by Alan Sommerer

(September 1998)

Contents

The JavaTM Archive (JAR) File Format is an excerpt from the online version of The JavaTM Tutorial Continued, The Rest of the JDK TM. The book version will be published by Addison-Wesley in December, 1998. The Java Tutorial Continued is the second volume of The Java Tutorial. It covers the rest of the core Java platform not covered in the first volume and is updated for JDK 1.2.

The Java Tutorial Continued covers many JDK features, including the following:

  • The JavaTM Collections Framework
  • Internationalization
  • 2D Graphics and Sound
  • JavaBeansTM
  • IDL (Interface Definition Language), which adds CORBA capabilities to the Java platform
  • Database connectivity through the JDBCTM
  • RMI (Remote Method Invocation)
  • Security
  • JNI (Java Native Interface)
  • Reflection
  • Reference Objects
  • Other topics such as Servlets and the Standard Extension Mechanism

Note: To navigate through The Java Archive (JAR) File Format excerpt, use the arrow icons and the "contents" link. To view the rest of The Java Tutorial Continued, use the trail map icon.

The Java Archive (JAR) File Format

The JavaTM Archive (JAR) file format enables you to bundle multiple files into a single archive file. Typically a JAR file will contain the class files and auxiliary resources associated with applets and applications.


Note: The JAR file format was introduced in version 1.1 of the Java Development Kit, and version 1.2 includes several enhancements to JAR file functionality. Unless otherwise noted, features covered in this trail pertain to both versions 1.1 and 1.2. If a feature description or example pertains only to one version, you'll be alerted with an annotation such as "version 1.2."

The JAR file format provides many benefits:

  • Security: You can digitally sign the contents of a JAR file. Users who recognize your signature can then optionally grant your software security privileges it wouldn't otherwise have.
  • Decreased download time: If your applet is bundled in a JAR file, the applet's class files and associated resources can be downloaded to a browser in a single HTTP transaction without the need for opening a new connection for each file.
  • Compression: The JAR format allows you to compress your files for efficient storage.
  • Packaging for extensions (version 1.2): The extensions framework provides a means by which you can add functionality to the Java core platform, and the JAR file format defines the packaging for extensions. Java 3DTM and JavaMail are examples of extensions developed by SunTM. By using the JAR file format, you can turn your software into extensions as well.
  • Package Sealing (version 1.2): Packages stored in JAR files can be optionally sealed so that the package can enforce version consistency. Sealing a package within a JAR file means that all classes defined in that package must be found in the same JAR file.
  • Package Versioning (version 1.2): A JAR file can hold data about the files it contains, such as vendor and version information.
  • Portability: The mechanism for handling JAR files is a standard part of the Java platform's core API.

This trail has three lessons:

Using JAR Files: The Basics shows you how to perform basic JAR-file operations, and how to run software that is bundled in JAR files. This lesson also introduces you to the concept of the JAR file's manifest, which plays an important role in more advanced JAR functionality.

Signing and Authenticating JAR Files shows you how to use the JDKTM tools to digitally sign JAR files and verify the signatures of signed JAR files.

Using JAR-related APIs Introduced in 1.2 introduces you to some of the new JAR-handling features in version 1.2 of the Java platform.

The JAR file format is an important part of the Java platform's extension mechanism. You can learn more about that aspect of JAR files in the The Extension Mechanism trail of this tutorial.

Alan Sommerer writes documentation about the JavaTM Development Kit for Java Software. Before moving to California, Alan was a physicist on the staff of the International Institute of Theoretical and Applied Physics at Iowa State University. He has also worked with Warthman Associates in Palo Alto, California, doing technical writing and applet programming for a variety of high-tech firms.


Reader Feedback

Tell us what you think of this book excerpt.

 Very worth reading  Worth reading  Not worth reading

If you have other comments or ideas for future articles, please type them here:

Please send comments about this trail to: tutorial@java.sun.com. You feedback is important to us!

Print Button
[ This page was updated: 27-Sep-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary | Feedback | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.