Java 清单文件
我正在尝试理解这些文件,我似乎可以找到可以轻松理解和记住的阅读内容。有人可以解释清单文件以及创建它们的原因吗?对捆绑包的解释也将不胜感激。
请并谢谢你
I am trying to make sense of these files, I can seem to find reading that makes it simple to understand and remember. Could someone explain manifest files, and why they were created? Explanation on bundles would be appreciated as well.
Please and thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Java 中的“Manifest”通常表示
META-INF/MANIFEST.MF
文件 在 jar 文件内。它添加有关 .jar 文件及其内容的元数据。
最常见的用途可能是指定 jar 文件的主类(通过 Main-Class 属性)以允许直接执行 jar 文件(使用 java -jar myFile.jar )。
其他用途是:
此一般 Java 机制是 本教程中对此进行了解释。
由于您还提到了捆绑包,因此您可能实际上正在谈论OSGi Bundle Manifest,它构建在该机制之上,将简单的 jar 文件转换为捆绑包(也称为“模块”,有时是“插件”)。
"Manifest" in Java usually means the
META-INF/MANIFEST.MF
file inside a jar file.It adds meta-data about the .jar file and its content.
The most common use is probably to specify the main class of the jar file (via the
Main-Class
attribute) to allow the jar file to be executed directly (usingjava -jar myFile.jar
).Other uses are:
This general Java mechanism is explained in this tutorial.
Since you also mention bundles, it might be possible that you're actually talking about an OSGi Bundle Manifest, which builds on top of that mechanism to turn a simple jar file into a bundle (a.k.a "a module", sometimes "a plugin").
在 Java 平台上,Manifest 文件是
JAR 存档中包含的特定文件。它用于定义扩展和包 -
相关数据。它是一个元数据文件,包含
以不同方式组织的名称-值对
部分。如果打算使用 JAR 文件
作为可执行文件,清单文件
指定应用程序的主类。这
清单文件名为 MANIFEST.MF 。
On the Java platform , a Manifest file is a
specific file contained within a JAR archive. It is used to define extension and package-
related data. It is a metadata file that contains
name-value pairs organized in different
sections. If a JAR file is intended to be used
as an executable file, the manifest file
specifies the main class of the application. The
manifest file is named MANIFEST.MF .
据我所知,清单的用途是:
大多数信息通常都是机器人和机器可读的。
As far as I know manifest are used:
Most of that info is usually bot human and machine readable anyway.