Current location - Quotes Website - Signature design - What is MANIFEST.MF and what is it used for?
What is MANIFEST.MF and what is it used for?

It can be opened through a text editor such as Notepad or Editplus, and the content inside can be analyzed.

MANIFEST.MF: This manifest file defines data related to extensions and packages. The word "manifest" means "to display."

Its classification:

General attributes

1. Manifest-Version

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

2. Created-By

Declare the generator of the file. 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

Application or class The loader uses this value to build the internal class search path

Application-related properties

1. Main-Class

Define the entry class of the jar file, which The class must be an executable class. Once this attribute is defined, the jar file can be run through java -jar x.jar.

Applet related attributes

1. Extension-List

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

2. -Extension-Name

3. -Specification-Version

4. - Implementation-Version

5. -Implementation-Vendor-Id

5. -Implementation-URL

Extended identification attribute

1. Extension-Name

This attribute defines the identification of the jar file, such as Extension-Name: Struts Framework

Package extension attribute

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 identity of the organization that implements the extension

5. Implementation-URL: defines the download address (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 the jar file is sealed, the value can be true or false

Signature-related attributes

For signature attributes, we can refer to a section in mail.jar provided by JavaMail

p>

Name: javax/mail/Address.class

Digest-Algorithms: SHA MD5

SHA-Digest: AjR7RqnN//cdYGouxbd06mSVfI4=

MD5-Digest: ZnTIQ2aQAtSNIOWXI1pQpw==

This content defines the class name of the class signature, the algorithm name for calculating the digest, and the corresponding digest content (encoded using the BASE64 method)

Customized Properties

In addition to some of the properties mentioned earlier, you can also add your own properties and response values ??in MANIFEST.MF. For example, the J2ME program jar package may contain the following information

MicroEdition-Configuration: CLDC-1.0

MIDlet-Name: J2ME_MOBBER Midlet Suite

MIDlet-Info-URL: /

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 to use: JDK provides us with an API for processing this information. We Manifest information can be obtained by passing the path of a jar file to JarFile and then calling the getManifest method of JarFile.