Wednesday, June 3, 2015

META-INF in Java

About JAR

JAR file is a file format based on the popular ZIP file format and is used for aggregating many files into one.
It is essentially a zip file that contains an optional META-INF directory.

About The META-INF Directory

META-INF directory is an optional directory structure contained in a JAR file, a file format containing java classes files and/or resources using the well-known ZIP file format.
A JAR file is normally created using a command-line jar tool or java.util.jar API in the Java package.
In META-INF directory, there is MANIFEST.MF file which is used to define extension and package related data and an INDEX.LIST file which contains location information for packages defined in an application or extension.
The INDEX.LIST file is normally generated using “–i” option of the jar command line tool. As a JarIndex implementation process it is used by class loaders to hasten the class loading process.
Other important files in META-INF Directory are x.SF and x.DSA where x stands for base file name. The x.SF is the signature file for the JAR file and the x.DSA is a signature block file related to the x.SF.
Also there exists a services sun directory in the META-INF Directory which stores all the service provider configuration files.

Summarized info. about META-INF

The META-INF Directory consists of the following files, which is used to configure the applications, extensions, class loaders and services:
  1. MANIFEST.MF ------> it is used to define extension and package related data.
  2. index.list ------> It contains the location information for packages defined in an application or extension.
    1. It is part of the JarIndex implementation and used by class loaders to speed up their class loading process.
  3. x.SF -------> The signature file for the JAR file. 'x' stands for the base file name.
  4. x.DSA --------> The signature block file associated with the signature file with the same base file name.
    1. This file stores the digital signature of the corresponding signature file.
  5. services/ -------> This directory stores all the service provider configuration files.
  • Note-
For further reference:-
http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html

No comments: