The JAR (Java Archive) is a file format based on the zip file format.
It is used to bundle Java applications or applets of resources, class files, sound files, images, etc. It also provides data compression. A jar file as a special type of zip file. The contents of the jar file can be digitally signed to provide security. It provides a platform-independent file format.
You can use the Jar API to process jar files in a Java program. Jar files can have optional META-INF directories to contain the files and directories that contain application configuration information.
Meta-inf Directory
The following table lists the META-INF entries in the directory.
| name |
type |
Purpose |
| MANIFEST. Mf |
File |
It contains extensions and packet-related data. |
| INDEX. LIST |
File |
It contains the location information for the package. The class loader uses it to speed up the class search and load process. |
| X.sf |
File |
X is the base file name. It stores the signature of the jar file. |
| X.dsa |
File |
X is the base file name. It stores the digital signature of the corresponding signature file. |
| /services |
Directory |
This directory contains all the service provider configuration files. |
jar Tool
The JDK provides a jar tool to create and manipulate jar files. You can also use java.util.jar the classes in the package to create and manipulate jar files using the Java API.
The JAR API has some new classes to work with the manifest file. Manifestclass represents a manifest file. jarmany command-line options are available to create jar files using tools.
The following code lists the jar tool's command-line options.
Click on the link to view the details
Java jar File