使用Eclipse for JAR文件自动创建清单文件 [英] Automatically Creating Manifest File with Eclipse for JAR Files
问题描述
如何为已经创建的一组JAR文件创建Manifest
文件.
How can I create a Manifest
file for a group of JAR file I have already created.
我使用Eclipse创建了JAR文件.
I used Eclipse to create my JAR file.
是否有更好的方法来创建具有Manifest
的JAR文件?
Is there any better way of creating a JAR file that has a Manifest
?
推荐答案
Eclipse提供了用于为Jar生成清单文件,将生成的清单保存到项目中或为清单使用指定文件的选项.
Eclipse provides options to generate a manifest file for the Jar, save that generated manifest into the project, or use a specified file for the manifest.
我有Eclipse 3.4.2,它在此过程的第四个屏幕上:
I have Eclipse 3.4.2 and it's on the fourth screen in this process:
右键单击项目->导出-> Java/JAR文件,下一步,JAR文件规范,下一步,JAR打包选项,下一步,JAR清单规范.
Right-click Project -> Export -> Java/JAR file, Next, JAR File Specification, Next, JAR Packaging Options, Next, JAR Manifest Specification.
默认情况是仅为JAR生成默认清单,而不是将生成的文件保存回项目,因此,如果打开JAR文件,它将具有清单,但仅包含以下内容: :
The default is to just generate a default manifest for the JAR, and not to save the generated file back to the project, so if you open up your JAR file, it will have a manifest, but it will just have something like:
Manifest-Version: 1.0
在其中.
如果要更改现有的JAR而不重新构建它们,最简单的方法可能就是按照mad-j的建议进行操作,并使用Zip工具打开它们并编辑现有的/META-INF/MANIFEST.MF文件.并将其保存回JAR.
If you want to change your existing JARs without re-building them, the easiest way is probably to just do as mad-j suggested and open them with a Zip tool and edit the existing /META-INF/MANIFEST.MF file and save it back into the JAR.
这篇关于使用Eclipse for JAR文件自动创建清单文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!