`

jar命令中的MANIFEST文件属性列表

    博客分类:
  • java
UP 
阅读更多
官方链接:JAR File Specification
MANIFEST.MF文件属性:

Main Attributes

Main attributes are the attributes that are present in the main section of the manifest. They fall into the following different groups:
  • general main attributes
    • Manifest-Version:
      Defines the manifest file version. The value is a legitimate version number, as described in the above spec.
       
    • Created-By:

    • Defines the version and the vendor of the java implementation on top of which this manifest file is generated. This attribute is generated by the jar tool.
       
    • Signature-Version:

    • Defines the signature version of the jar file. The value should be a valid version-number string.
       
    • Class-Path :

    • The value of this attribute specifies the relative URLs of the extensions or libraries that this application or extension needs. URLs are separated by one or more spaces. The application or extension class loader uses the value of this attribute to construct its internal search path.
       
  • attribute defined for stand-alone applications
  • This attribute is used by stand-alone applications that are bundled into executable jar files which can be invoked by the java runtime directly by running "java -jar x.jar".
    • Main-Class :

    • The value of this attribute defines the relative path of the main application class which the launcher will load at startup time. The value must not have the .class extension appended to the class name.
  • attributes defined for applets
  • These attributes is used by an applet which is bundled into JAR files to define requirements, version and location information for the extensions which this applet depends on. (see  Extension Versioning ). 
    • Extension-List:

    • This attribute indicates the extensions that are needed by the applet. Each extension listed in this attribute will have a set of additional attributes that the applet uses to specify which version and vendor of the extension it requires.
       
    • <extension>-Extension-Name :

    • This attribute is the unique name of the extension. The Java Plug-in will compare the value of this attribute with the Extension-Name attribute in the manifests of installed extensions to determine if the extension is installed.
       
    • <extension>-Specification-Version

    • This attribute specifies the minimum extension specification version that is required by the applet. The Java Plug-in will compare the value of this attribute with the Specification-Version attribute of the installed extension to determine if the extension is up to date.
       
    • <extension>-Implementation-Version

    • This attritute specifies the minimum extension implementation version number that is required by the applet. The Java Plug-in will compare the value of this attribute with the Implementation-Version attribute of the installed extension to see if a more recent implementation needs to be downloaded.
       
    • <extension>-Implementation-Vendor-Id

    • This attribute can be used to identify the vendor of an extension implementation if the applet requires an implementation from a specific vendor. The Java Plug-in will compare the value of this attribute with the Implementation-Vendor-Id attribute of the installed extension.
       
    • <extension>-Implementation-URL

    • This attribute specifies a URL that can be used to obtain the most recent version of the extension if the required version is not already installed.
       
  • attribute defined for extension identification
  • This attribute is used by extensions to define their unique identity.
    • Extension-Name:
    • This attribute specifies a name for the extension contained in the Jar file. The name should be a unique identifier such as the name of the main package comprising the extension.
     
  • attributes defined for extension and  package versioning  and sealing information
  • These attributes define features of the extension which the JAR file is a part of. The value of these attributes apply to all the packages in the JAR file, but can be overridden by per-entry attributes. 
    • Implementation-Title :
    • The value is a string that defines the title of the extension implementation. 
    • Implementation-Version :

    • The value is a string that defines the version of the extension implementation.
       
    • Implementation-Vendor :

    • The value is a string that defines the organization that maintains the extension implementation.
       
    • Implementation-Vendor-Id :

    • The value is a string id that uniquely defines the organization that maintains the  extension implementation.
       
    • Implementation-URL :

    • This attribute defines the URL from which the extension implementation can be downloaded from.
       
    •  Specification-Title :

    • The value is a string that defines the title of the extension specification.
       
    • Specification-Version :

    • The value is a string that defines the version of the extension specification.
       
    • Specification-Vendor :

    • The value is a string that defines the organization that maintains the extension specification.
    • Sealed :

    • This attribute defines whether this JAR file is sealed or not. The value can be either "true" or "false", case is ignored. If it is set to "true", then all the packages in the JAR file are defaulted to be sealed, unless they are defined otherwise individually.

分享到:
评论

相关推荐

    JAR文件包及jar命令详解

    - MANIFEST文件中的`Main-Class`属性必须正确设置,包括正确的包路径。 - 如果JAR文件中包含其他依赖的库文件(如第三方JAR),也需要一并打包进去或者在运行时通过`-cp`参数指定。 #### 三、总结 JAR文件作为一种...

    jar命令使用示例

    在构建JAR时,这些依赖可以被包含在最终的JAR文件中,或者通过`Class-Path`属性在manifest文件中引用。 总结,`jar`命令是Java开发中处理类文件和资源的关键工具。了解其用法,能够有效地管理和分发Java应用程序。...

    将java文件打包成 jar jar命令详解

    假设你需要将两个 `.class` 文件 `Foo.class` 和 `Bar.class` 打包到一个名为 `classes.jar` 的 JAR 文件中,可以使用以下命令: ``` jar cvf classes.jar Foo.class Bar.class ``` - `c`: 表示创建一个新的 JAR ...

    制作可执行的JAR文件包及jar命令详解

    ### 制作可执行的JAR文件包及jar命令详解 在Java开发中,将多个类文件、资源文件以及依赖库打包成一个可执行的JAR(Java Archive)文件是常见的需求,尤其对于构建独立运行的应用程序尤为重要。本文将深入探讨如何...

    jar命令集合

    JAR命令是Java开发工具包(JDK)中的一项重要功能,用于创建、管理和操作JAR文件。JAR(Java ARchive)是一种压缩文件格式,类似于ZIP文件,主要用于将多个Java类文件和其他资源打包在一起,便于分发和管理。JAR文件的...

    可执行jar及命令详解

    - 如果JAR文件依赖于外部库,需要在MANIFEST文件中通过`Class-Path`属性指定这些库的位置。 - 使用`jar`命令时,需要注意命令参数的顺序和格式,避免出错。 总之,理解JAR文件的工作原理以及如何使用`jar`命令对于...

    JAR文件包及jar命令详解.rar

    其中,`cvfm`参数分别代表创建(c)、添加到归档文件(v)、指定manifest文件(f)和manifest文件名。 3. **jar命令详解** - `jar cvf JarName.jar DirectoryOrFiles`:创建一个新的JAR文件,包含指定目录或文件...

    java 程序都编译成执行文件jar命令详解

    创建了 MANIFEST.MF 文件后,将其与 `.class` 文件放在同一目录下,然后在上一级目录执行上面的 `jar` 命令,这样生成的 `test.jar` 就是一个可执行 JAR 文件。在 Windows 上,用户只需安装了 JRE,就可以双击运行该...

    jar命令大全打包及运行

    ### jar命令大全:打包与运行详解 在Java开发中,`jar`命令是处理Java Archive (JAR) 文件的关键工具,用于将多个类文件、资源文件以及清单文件(Manifest)打包成一个单一的JAR文件,便于管理和部署。本文将深入...

    jar命令知识的总结

    Manifest文件中的属性与值之间需以冒号和空格分隔,如`Main-Class: Test`。 ### 四、使用jar命令 使用jar命令可以执行以下操作: - 创建JAR文件:`jar cf jarfilename.jar file1 file2 ...` - 更新JAR文件:`jar ...

    Jar文件包间接及Jar命令开发实例详解

    ### Jar文件包间接及Jar命令开发实例详解 #### 一、引言 在Java开发过程中,经常遇到将Java程序封装成可直接运行的文件的需求。本文将详细介绍如何使用Jar文件包以及Jar命令来实现这一目标,并通过实际示例加深理解...

    maven生成可执行jar命令

    为了使JAR文件可执行,通常需要在MANIFEST.MF文件中定义`Main-Class`属性,该属性指定了JAR文件的入口类,即程序的主类。 #### Maven插件介绍 为了实现将Maven项目打包成可执行的JAR文件,我们需要使用到Maven的几...

    java打包成jar

    这里`jar`是命令,`cvfm`是选项,`cal.jar`是输出的JAR文件名,`manifest.mf`是Manifest文件,`*.class`表示所有`.class`文件。 4. **选项解释**: - `-c` 创建新的归档文件。 - `-v` 输出详细信息。 - `-f` ...

    Java项目后台打包jar包执行报错“没有主清单属性”

    5. 最后,保存pom.xml文件,然后在命令行或者IDE中执行Maven的打包命令,通常是`mvn clean package`,这将根据pom.xml的配置打包项目,并生成包含主清单属性的jar文件。 注意:如果你的项目不是Spring Boot应用,你...

    jar 批处理命令

    批处理命令可以包括创建MANIFEST文件和构建JAR的步骤: ``` echo Main-Class: com.mycompany.MyApp &gt; Manifest.txt jar cmf Manifest.txt myapp.jar com/mycompany/*.class ``` 4. **包含依赖**: 如果JAR文件...

    如何生成jar包

    jar命令的基本格式为:`jar [选项] [manifest文件] -C 目录名 [文件]` 选项部分为ctxum0M,具体含义如下: - c 创建一个新的JAR文件包 - t 列出JAR文件包中的内容 - x 展开JAR文件包中的指定文件或全部文件 - u ...

    生成jar文件

    对于属性文件,Java可以自动从JAR中加载,例如: ```java ResourceBundle.getBundle("com.abc.test"); ``` 这时,`test.properties`只需放在JAR的`com/abc/`目录下。 3. **JAR工具**:JAR工具位于JDK安装目录...

Global site tag (gtag.js) - Google Analytics