What is the significance of the manifest in a jar file




















The manifest is a special file that can contain information about the files packaged in a JAR file. By tailoring this "meta" information that the manifest contains, you enable the JAR file to serve a variety of purposes. This lesson will explain the contents of the manifest file and show you how to work with it, with examples for the basic features:. When you create a JAR file, a default manifest is created automatically.

This section describes the default manifest. This section shows you the basic method of modifying a manifest file. The later sections demonstrate specific modifications you may want to make. The later sections demonstrate specific modifications you may want to make. Setting an Application's Entry Point This section describes how to use the Main-Class header in the manifest file to set an application's entry point. Setting Package Version Information This section describes how to use the package version headers in the manifest file.

Package Versioning: The Package Versioning specification defines several manifest headers to hold versioning information. One set of such headers can be assigned to each package. The versioning headers should appear directly beneath the Name header for the package.

This example shows all the versioning headers:. Whenever a JAR file is created a default manifest. The first one specifies the manifest version and second one specifies the JDK version with which the JAR file is created.

Main-Class header: When a JAR file is used to bundle an application in a package, we need to specify the class serving an entry point of the application. After specifying this entry we can execute the JAR file to run the application. Package version related headers: When the JAR file is used for package versioning the following headers are used as specified by the Java language specification:.

We can also specify if any particular packages inside a JAR file should be sealed meaning all the classes defined in that package must be archived in the same JAR file. This folder is where the manifest file resides. Also, it can contain more files containing meta data about the application. Also, it contains the xml file containing mapping of an abstract EJB references to concrete container resources of the application server on which it will be run. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. MF file in Java Ask Question. Asked 9 years, 1 month ago. Active 4 years, 11 months ago. Viewed k times. Improve this question. Anand Anand Add a comment. Active Oldest Votes. Manifest-Version: 1. This information is provided in the Main-Class header, which has the general form: Main-Class: classname The value classname is to be replaced with the application's entry point.

A Class-Path header might look like this, for example: Class-Path: servlet. Implementation-Title: "java. Improve this answer.



0コメント

  • 1000 / 1000