Manifest. MF Configuration

Source: Internet
Author: User

Open the JAR file of Java we often see that the file contains a META-INF directory, there are some files under this directory, there must be a manifest. mf: This file describes a lot of information about the JAR file. The following describes manifest in detail. for the content of the MF file, see struts first. manifest. mf file content:

Manifest-version: 1.0

Created-by: Apache ant 1.5.1

Extension-Name: Struts Framework

Specification-title: Struts Framework

Specification-vendor: Apache Software Foundation

Specification-version: 1.1

Implementation-title: Struts Framework

Implementation-vendor: Apache Software Foundation

Implementation-vendor-ID: org. Apache

Implementation-version: 1.1

Class-path: commons-beanutils.jar commons-collections.jar commons-digester.jar commons-logging.jar commons-validator.jar jakarta-oro.jar struts-legacy.jar

If we classify the configuration information in manifest, We can summarize the following categories:

I. general attributes

1. manifest-version

Used to define the version of the manifest file, for example, manifest-version: 1.0

2. Created-

The file creator. Generally, this attribute is generated by the jar command line tool, for example, created-by: Apache ant 1.5.1.

3. Signature-version

Define the signature version of the JAR File

4. Class-Path

This value is used by applications or classloaders to build an internal class search path.

2. Application-related attributes

1. Main-class

Define the entry class of the JAR file, which must be an executable class. Once this attribute is defined, you can run the JAR file through Java-jar X. jar.

3. Applet-related attributes

1. extendsion-list

This attribute specifies the extended information list required by the applet. Each name in the list corresponds to the following attributes:

2. <extension>-extension-name

3. <extension>-specification-version

4. <extension>-implementation-version

5. <extension>-implementation-vendor-ID

5. <extension>-implementation-URL

Iv. Extended identity attributes

1. Extension-name

This attribute defines the identity of the JAR file, such as extension-Name: Struts Framework

5. Package extended attributes

1. Implementation-title defines the title of the extension implementation

2. Implementation-version defines the version of the extension implementation

3. Implementation-vendor defines the organization of the extension implementation

4. Implementation-vendor-ID defines the identifier of the organization for the extension implementation

5. Implementation-URL: Specifies the URL of the extension package)

6. Specification-title defines the title of the extension Specification

7. Specification-version defines the version of the extension Specification

8. Specification-Vendor declares the organization that maintains the Specification

9. Sealed defines whether to seal the JAR file. The value can be true or false (which I do not quite understand)

Vi. Signature-related attributes

For signature attributes, refer to the section in mail. Jar provided by javamail.

Name: javax/mail/address. Class

Digest-algorithms: Sha MD5

Sha-Digest: ajr7rqnn // cdygouxbd06msvfi4 =

MD5-Digest: zntiq2aqatsniowxi1pqpw =

This section defines the Class Name of the class signature, the algorithm name for calculating the digest, and the corresponding digest content (encoded using base64)

VII. Custom Attributes

In addition to the attributes mentioned above, you can also add your own attributes and response values in manifest. MF. For example, the jar package of the Java program may contain the following information:

Microedition-configuration: CLDC-1.0

MIDlet-Name: j2me_mobber MIDlet suite

MIDlet-Info-URL: http://www.javayou.com/

MIDlet-icon:/icon.png

MIDlet-vendor: MIDlet suite vendor

MIDlet-1: mobber,/icon.png, mobber

MIDlet-version: 1.0.0

Microedition-profile: MIDP-1.0

MIDlet-Description: Communicator

How can we read this information? JDK provides an API for processing this information. For more information, see Java. util. in the jar package, we can pass a jar file path to jarfile, and then call the getmanifest method of jarfile to obtain manifest information.

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.