站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Java Tutorial 5.0 英文版

Packaging Programs in JAR Files - Java Tutorial 5.0 英文版

The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail Search
Feedback Form

Trail: Deployment

Lesson: Packaging Programs in JAR Files


This chapter has been updated to reflect features and conventions of the latest release, JDK 5.0. If you notice any errors or omissions (or something you really like), please tell us.
The JavaTM Archive (JAR) file format enables you to bundle multiple files into a single archive file. Typically a JAR file contains the class files and auxiliary resources associated with applets and applications.

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: 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 (outside of the tutorial) and JavaMail (outside of the tutorial) are examples of extensions developed by SunTM. By using the JAR file format, you can turn your software into extensions as well.
  • Package Sealing: 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: 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 lesson has four sections:

Using JAR Files: The Basics (in the Deployment trail)

This section shows you how to perform basic JAR-file operations, and how to run software that is bundled in JAR files.

Working with Manifest Files: The Basics (in the Deployment trail)

This section explains manifest files and how to customize them so you can do such things as seal packages and set an application's entry point.

Signing and Verifying JAR Files (in the Deployment trail)

This section shows you how to digitally sign JAR files and verify the signatures of signed JAR files.

Using JAR-related APIs (in the Deployment trail)

This section introduces you to some of the JAR-handling features 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.

Additional References

The documenation for the Java Development Kit includes information about the Jar tool:

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.