Java Magic Hall: the meta-inf/mainfest of packaging knowledge points. Mf

Source: Internet
Author: User

I. Preface by executing a form such as the JAR-CVF src.jar src command to package multiple. class files into a jar package, you will find that the jar package has more than one mate-inf/ma in addition to the SRC directory. INFEST. MF, what's that for? In fact, the description information about the jar package, the configuration information at startup and security information are all kept under Meta-inf, so it is important to understand the Meta-inf directory for publishing and deployment! The following is only part of the content of the collation, and later in-depth practice after the completion of the supplement. Official documents: Http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html II, Meta-inf/mainfest. The MF manifest file consists of element meta-inf/mainfest. The MF manifest file consists of 1 main-section and 0 to N individual-section, and each section contains multiple attribute, where attribute in Main-section is named Main-attribute, while the attribute in Individual-section is named Perentry-attribute. Each attribute is used as a delimiter (used as a delimiter under UNIX and used as a delimiter under Mac). Individual-section identifies the range with a perentry-attribute named name, and acts as the starting row for the zone. Example: manifest-version:1.0 created-by:1.2 (Sun Microsystems Inc.) Sealed:true Name:foo/bar/sealed:false main-section is used to describe the security, configuration information, and default information for all packages and files within a jar package. Each individual-section is used to describe a single package or file in a jar package, but not every package and file in the jar package must be configured with Individual-section, but for files that need to be signed you must configure the corresponding It's individual-section.                            Three, Main-attribute detailed 1. General Properties Mainfest-version:jar version number created-by: Producer Signature-version: Signature version Class-path: A list of dependencies, separated by a space if multiple dependencies exist. The dependency path is relative path 2 with the jar package path as the reference system. Executable Jar Package Property Main-class:main function is located in the fully qualified class name four, Perentry-attribute detailed 1. The Name property, the starting property of the Individual-section, the package naming specification, such as: com/test/myapp/, the file naming specification form: Com/test/myapp/myapp.class. 2. Define the file content content-type:mime type (format: Type/subtype. For example, Image/jpeg) five, note 1. Key-value pairs occupy one or more rows independently of each other; 2. The maximum length per line is 72 characters; 3. The last character of each line must end with a carriage return newline character, and the carriage return newline character cannot have spaces (using regular expressions to express each line specification is/^.+\s\r\n$/); 4. If the key-value pair occupies more than one row, then from the second line, you must start with a space or more (the specification for expressing the second row and the remaining lines using regular expressions is/^[]{1,}.+\s\r\n$/). Respect the original, reprint please indicate from: http://www.cnblogs.com/fsjohnhuang/p/4046856.html ^_^ Fat Boy John reference Http://blog. csdn.net/zhifeiyu2008/article/details/8829637 http://docs.oracle.com/javase/7/docs/technotes/guides/jar/ Jar.html

Http://www.cnblogs.com/fsjohnhuang/p/4046856.html

Java Magic Hall: the meta-inf/mainfest of packaging knowledge points. MF (RPM)

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.