如何在Eclipse中导出带有特定清单文件和所需库提取的可运行jar? [英] How can I export a runnable jar in Eclipse with a specific manifest file and required library extraction?

查看:171
本文介绍了如何在Eclipse中导出带有特定清单文件和所需库提取的可运行jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse中的导出为可运行的Jar"选项导出了项目,该项目本来运行得很好.

I exported my project using the Export as Runnable Jar option in Eclipse, which worked perfectly fine originally.

但是,现在我需要在Runnable jar的清单中包含一个初始图像,在导出为Runnable Jar时无法指定该图像.

However, I now have a splash image that I need to include in the manifest for the Runnable jar, which cannot be specified when exporting as a Runnable Jar.

因此,我尝试执行导出为Jar"并只是在此处手动设置清单.它允许我设置清单,但是出现了另一个问题.它不允许我提取/打包所需的库,例如Runnable Jar导出允许我这样做.

So, I tried to do Export as a Jar and just set the manifest manually through there. It allows me to set the manifest, but another problem arises. It won't let me extract/package the required libraries like the Runnable Jar export allowed me to do.

如果有人可以告诉我一种方法,可以将项目导出为带有自定义清单的可运行jar,并将所需的库提取到jar中,我将不胜感激.

If someone could tell me a method where I could export the project as a runnable jar with a custom manifest and the extraction of required libraries into the jar, I would highly appreciate it.

推荐答案

感谢哈尔格帮助我找到解决方案!

Thanks to howlger for helping me find the solution!

首先,我好像要创建一个可运行的jar一样,方法是右键单击我的项目,单击导出",然后单击可运行的jar.

I first acted as if I wanted to create a runnable jar by right clicking my project, clicking export, and clicking runnable jar.

然后,我将其导出为可运行的jar,但还进行了检查,以将ant build脚本获取到我的桌面.

Then, I exported it as a runnable jar but also checked to get the ant build script to my desktop.

在生成的build.xml文件中,我使用文本编辑器程序对其进行了编辑,并添加了SplashScreen-Image属性

In the generated build.xml file, I edited it using a text editor program and added the SplashScreen-Image attribute

现在,要使用此新的构建脚本导出项目,请右键单击项目文件,转到属性,转到构建器,单击新建...",然后转到Ant Builder

Now, to use this new build script to export the project, right-click the project file, go to properties, go to builders, click New..., and go to Ant Builder

选择为Buildfile导出的修改后的构建文件的位置,然后选择项目文件夹作为Base Directory的基本目录.

Choose the location of the modified build file you exported for the Buildfile, and choose the project folder as the base directory for the Base Directory.

这就是您可以修改可运行jar文件的清单的方法.

And that's how you can modify the manifest of a runnable jar file.

更新:

要运行必要的蚂蚁配置,请单击绿色播放按钮右侧按钮旁边的箭头,如下所示:

To run the necessary ant configuration, click the arrow next to the button to the right of the green play button that looks like this:

单击箭头后,单击外部工具配置..."

Once you click the arrow, click "External Tools Configurations..."

添加先前创建的Ant Build配置,或者如果未显示,请使用前面的步骤添加它.

Add the Ant Build configuration previously made, or if it doesn't show up, add it using the previous steps.

完成此操作后,请单击关闭",然后单击旁边带有红色工具箱的上述播放按钮以进行构建.

Once this is done, click close and click on the aforementioned play button with the red toolbox next to it to build it.

这篇关于如何在Eclipse中导出带有特定清单文件和所需库提取的可运行jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆