javaEE规范 Manifest Class-Path作用

来源:互联网 发布:大数据修炼系统5200 编辑:程序博客网 时间:2024/05/14 06:44

Manifest Class-Path

The Java EE specification provides the manifest Class-Path entry as a means for a module to specify that it requires an auxiliary JAR of classes. You only need to use this manifest Class-Path entry if you have additional supporting JAR files as part of your EJB JAR or WAR file. In such cases, when you create the JAR or WAR file, you must include a manifest file with a Class-Path element that references the required JAR files.

The following is a simple manifest file that references a utility.jar file:

Manifest-Version: 1.0 [CRLF]Class-Path: utility.jar [CRLF]

In the first line of the manifest file, you must always include the Manifest-Version attribute, followed by a new line (CR | LF |CRLF) and then the Class-Path attribute. More information about the manifest format can be found at: http://java.sun.com/j2se/1.4/docs/guide/jar/jar.html#JAR

The manifest Class-Path entries refer to other archives relative to the current archive in which these entries are defined. This structure allows multiple WAR files and EJB JAR files to share a common library JAR. For example, if a WAR file contains a manifest entry of y.jar, this entry should be next to the WAR file (not within it) as follows:

/<directory>/x.war/<directory>/y.jars

The manifest file itself should be located in the archive at META-INF/MANIFEST.MF.

0 0
原创粉丝点击