简体   繁体   English

Eclipse下创建可执行Jar文件

[英]Create executable Jar file under Eclipse

I created a Java application and I want to create jar file for this application.我创建了一个 Java 应用程序,我想为这个应用程序创建 jar 文件。 This application imported other external jar files by Build Path>Add External Jar File.此应用程序通过构建路径>添加外部 Jar 文件导入其他外部 jar 文件。 How can I generate executable JAR file for this application in Ubuntu with these external libraries dependencies?如何使用这些外部库依赖项在 Ubuntu 中为此应用程序生成可执行 JAR 文件?

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.展开 Java 节点并选择 Runnable JAR 文件。 Click Next.点击下一步。
  3. In the Runnable JAR File Specification page, select a 'Java Application' launch configuration to use to create a runnable JAR.在 Runnable JAR File Specification 页面中,选择用于创建可运行 JAR 的“Java 应用程序”启动配置。
  4. In the Export destination field, either type or click Browse to select a location for the JAR file.在导出目标字段中,键入或单击浏览以选择 JAR 文件的位置。
  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.或者,您还可以创建一个 ANT 脚本来快速重新生成以前创建的可运行 JAR 文件。

Right click on project which one you want to create executable jar右键单击要创建可执行 jar 的项目

-> Export -> Runnable jar 

在此处输入图片说明

-> Select the Main class in "Launch Configuration" -> Export destination (your system path) -> Finish

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM