JAR (Java Archive) is a file format based on the ZIP file format.
It bundles resources, class files, sound files, images, etc. for a Java application or applet.
JAR file is a special kind of a ZIP file.
You can digitally sign the contents of a JAR file to provide security.
Java can use the JAR API to manipulate a JAR file in a Java program.
JAR file can have an optional META-INF directory to contain files and directories containing information about application configuration.
The following table lists the entries in a META-INF directory.
|MANIFEST.MF||File||It contains extension and package related data.|
|INDEX.LIST||File||It contains location information of packages. Class loaders use it to speed up the class searching and loading process.|
|X.SF||File||X is the base file name. It stores the signature for the jar file.|
|X.DSA||File||X is the base file name. It stores the digital signature of the corresponding signature file.|
|/services||Directory||contains all service provider configuration files.|
The JDK ships a jar tool to create and manipulate JAR files.
You can create and manipulate a JAR file using the Java API using classes in the java.util.jar package.
JarEntry class inherits from the ZipEntry class; the JarInputStream class inherits from the ZipInputStream class; the JarOutputStream class inherits from the ZipOutputStream class, etc.
The JAR API has classes to deal with a manifest file. The Manifest class represents a manifest file.