The jar file can optionally contain a META-INF
file named in the directory MANIFEST.MF
Manifest
. Manifest
The file contains information about the jar file and its entries. The Manifest
file can contain information about the settings of the jar file CLASSPATH
and its main item class.
The main item class is the class that has the method to start the standalone application main()
, the version information for the package, and so on.
manifest
The file is divided into sections separated by blank lines. Each section contains a name-value pair. A new row separates each name/value pair. The colon separates the name and its corresponding value.
The manifest file must end with a new line. The following is a sample manifest file:
1234 |
Manifest-Version: 1.0 Created-By: 1.8 .0_20-ea-b05 (Oracle Corporation) Main-Class: cn.sxt.Main Profile: compact1 |
The above manifest
file has a section with four attributes:
Manifest-version
Created-by
Main-class
Profile
Part of the jar manifest file
manifest
There are two types of parts in a file: The main part and the individual parts.
A blank line must separate any two parts. The entries in the main section apply to the entire JAR file. The entries in a single section apply to specific entries.
The properties in a single section override the same properties in the main section. A single entry begins with a "name" property whose value is the name of the entry in the jar file followed by other properties of the entry.
Click on the link to view the details
Java Jar Manifest