JAR File Discovery: Exploring the powerful features of the jar file format

Source: Internet
Author: User
Tags zip

What is a JAR file?

The JAR file format is based on the popular ZIP file format used to aggregate many files into one file. Unlike ZIP files, JAR files are used not only for compression and publishing, but also for deploying and encapsulating libraries, components, and plug-ins, and can be used directly by tools such as compilers and JVMs. Include special files in jars, such as manifests and deployment descriptors, to indicate how the tool handles specific jars.

A JAR file can be used to:

For publishing and using class libraries

As the building blocks of applications and extensions

Unit of deployment as a component, applet, or plug-in program

Used to package the auxiliary resources associated with the component

The JAR file format offers many advantages and features, many of which are not provided by traditional compression formats such as ZIP or TAR. They include:

Security. You can add a digital signature to the contents of the JAR file. This allows the signature-aware tool to selectively grant you software security privileges that other files cannot, and it can also detect if the code has been tampered with.

Reduce download time. If an applet is bundled into a JAR file, the browser can download the applet's class file and related resources in an HTTP transaction instead of opening a new connection to each file.

Compression. The JAR format allows you to compress files to improve storage efficiency.

Transport platform Extensions. The Java extension Framework (Java Extensions Framework) provides a way to add functionality to the Java core platform, packaged with JAR files (Java and JavaMail are examples of extensions developed by Sun).

Package seals. Packages stored in JAR files can optionally be sealed to enhance versioning consistency and security. Sealing a package means that all classes in the package must be found in the same JAR file.

Package version control. A JAR file can contain 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 core API.

Compressed and uncompressed jars

The Jar tool (see the Jar tool for details) compresses files by default. Uncompressed jar files can generally be loaded faster than compressed jar files because the files are uncompressed during the load, but uncompressed files may download longer on the network.

Meta-inf Directory

Most JAR files contain a meta-inf directory that is used to store packages and extended configuration data, such as security and version information. The Java 2 platform identifies and interprets the following files and directories in the Meta-inf directory to configure applications, extensions, and class loaders:

MANIFEST. Mf. This manifest file defines the data associated with the extension and package.

INDEX. LIST. This file is generated by the new option-I of the Jar tool, which contains the location information for the packages defined in the application or extension. It is part of the Jarindex implementation and is used by the class loader to accelerate the class loading process.

Xxx. SF. This is the signature file for the JAR file. Placeholder XXX identifies the signer.

Xxx. Dsa. The signature block file associated with the signature file that stores the public signature used to sign the JAR file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.