Java Eclipse下创建可执行Jar文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25113692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create executable Jar file under Eclipse
提问by user3766188
I created a Java application and I want to create jar file for this application. This application imported other external jar files by Build Path>Add External Jar File. How can I generate executable JAR file for this application in Ubuntu with these external libraries dependencies?
我创建了一个 Java 应用程序,我想为这个应用程序创建 jar 文件。此应用程序通过构建路径>添加外部 Jar 文件导入其他外部 jar 文件。如何使用这些外部库依赖项在 Ubuntu 中为此应用程序生成可执行 JAR 文件?
采纳答案by 4aRk Kn1gh7
To create a new runnable JAR file in the workbench:
在工作台中创建一个新的可运行 JAR 文件:
- From the menu bar's File menu, select Export.
- Expand the Java node and select Runnable JAR file. Click Next.
- In the Runnable JAR File Specification page, select a 'Java Application' launch configuration to use to create a runnable JAR.
- In the Export destination field, either type or click Browse to select a location for the JAR file.
- Select an appropriate library handling strategy.
- Optionally, you can also create an ANT script to quickly regenerate a previously created runnable JAR file.
- 从菜单栏的文件菜单中,选择导出。
- 展开 Java 节点并选择 Runnable JAR 文件。点击下一步。
- 在 Runnable JAR File Specification 页面中,选择一个“Java 应用程序”启动配置来创建一个可运行的 JAR。
- 在导出目标字段中,键入或单击浏览以选择 JAR 文件的位置。
- 选择合适的库处理策略。
- 或者,您还可以创建一个 ANT 脚本来快速重新生成以前创建的可运行 JAR 文件。