Java:在 eclipse 中导出到 .jar 文件

发布于 2024-07-11 05:28:00 字数 202 浏览 7 评论 0原文

我正在尝试将 Eclipse 中的程序导出到 jar 文件。

在我的项目中,我添加了一些图片和 PDF:s。 当我导出到 jar 文件时,似乎只有 main 已被编译和导出。

我的意愿是如果可能的话将所有内容导出到 jar 文件,因为这样我想将其转换为可引渡的文件,例如 .exe 文件。

但如何呢?

I'm trying to export a program in Eclipse to a jar file.

In my project I have added some pictures and PDF:s. When I'm exporting to jar file, it seems that only the main has been compiled and exported.

My will is to export everything to a jar file if it's possible, because then I want to convert it to an extraditable file, like .exe-file.

But how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

花伊自在美 2024-07-18 05:28:01

无需外部插件。 在导出 JAR 对话框中,确保选择所有要导出的必要资源。 默认情况下,导出其他资源文件(图片、配置文件等)应该没有问题,请参见下面的屏幕截图。
JAR 导出对话框

No need for external plugins. In the Export JAR dialog, make sure you select all the necessary resources you want to export. By default, there should be no problem exporting other resource files as well (pictures, configuration files, etc...), see screenshot below.
JAR Export Dialog

〆一缕阳光ご 2024-07-18 05:28:01

转到文件->导出->JAR 文件,您可以选择“导出生成的类文件和源”并确保选择您的项目,并且下面的所有文件夹也都被选中! 祝你好运!

Go to file->export->JAR file, there you may select "Export generated class files and sources" and make sure that your project is selected, and all folder under there are also! Good luck!

悲欢浪云 2024-07-18 05:28:01

FatJar 在这种情况下可以为您提供帮助。

除了 Eclipse 中包含的“导出为 Jar”功能之外,该插件还将所有相关 JAR 捆绑在一起到一个可执行 jar 中。
该插件将条目“Build Fat Jar”添加到 Java 项目的上下文菜单中。

如果您最终导出的 jar 包含其他外部 jar,这非常有用。

如果您有 Ganymede,“导出 Jar”对话框足以从项目中导出资源。

在 Ganymede 之后,您有:

Export Jar

FatJar can help you in this case.

In addition to the"Export as Jar" function which is included to Eclipse the Plug-In bundles all dependent JARs together into one executable jar.
The Plug-In adds the Entry "Build Fat Jar" to the Context-Menu of Java-projects

This is useful if your final exported jar includes other external jars.

If you have Ganymede, the Export Jar dialog is enough to export your resources from your project.

After Ganymede, you have:

Export Jar

终弃我 2024-07-18 05:28:01

另一种选择是 WinRun4J。 有一个 WinRun4J 的 Eclipse 插件,它允许您将应用程序导出为单个可执行文件嵌入的罐子/类。

(全面披露:我从事这个项目)

One more option is WinRun4J. There is an Eclipse Plugin for WinRun4J that allows you to export your application as a single executable with necessary jars/classes embedded.

(full disclosure: I work on this project)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文