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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 23:39:53  来源:igfitidea点击:

Create executable Jar file under Eclipse

javaeclipse

提问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 文件:

  1. From the menu bar's File menu, select Export.
  2. Expand the Java node and select Runnable JAR file. Click Next.
  3. In the Runnable JAR File Specification page, select a 'Java Application' launch configuration to use to create a runnable JAR.
  4. In the Export destination field, either type or click Browse to select a location for the JAR file.
  5. Select an appropriate library handling strategy.
  6. Optionally, you can also create an ANT script to quickly regenerate a previously created runnable JAR file.
  1. 从菜单栏的文件菜单中,选择导出。
  2. 展开 Java 节点并选择 Runnable JAR 文件。点击下一步。
  3. 在 Runnable JAR File Specification 页面中,选择一个“Java 应用程序”启动配置来创建一个可运行的 JAR。
  4. 在导出目标字段中,键入或单击浏览以选择 JAR 文件的位置。
  5. 选择合适的库处理策略。
  6. 或者,您还可以创建一个 ANT 脚本来快速重新生成以前创建的可运行 JAR 文件。