Eclipse 创建可运行的 jar 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2282777/
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-09-19 14:25:38  来源:igfitidea点击:

Eclipse create runnable jar problem

javaeclipsejar

提问by Marquinio

Ok I created a new Java project in Eclipse with Java class and its main method. Then when doing an export - runnable jar I do not see my new project being listed in the "Launch Configurations" drop down. I can see other projects but not the newly created one.

好的,我在 Eclipse 中使用 Java 类及其主要方法创建了一个新的 Java 项目。然后在执行导出 - 可运行 jar 时,我没有看到我的新项目列在“启动配置”下拉列表中。我可以看到其他项目,但不能看到新创建的项目。

I'm I missing something?

我错过了什么吗?

public class SSLTest {
   public static void main(String[] args)  {
}
}

回答by Kaleb Brasee

Did you run SSLTestin Eclipse? I think you need to run that class (through the Run menu) in order for Eclipse to create a launch configuration.

SSLTest在 Eclipse 中运行过吗?我认为您需要运行该类(通过运行菜单),以便 Eclipse 创建启动配置。

回答by Sayan

Go to Run as-> Run as Java Application your java file having main class. There you go -> Now you can see your project listed in "Launch Configurations" when you try to export as runnable jar file.

转到 Run as-> Run as Java Application 你的具有主类的 java 文件。好了 -> 现在,当您尝试导出为可运行的 jar 文件时,您可以在“启动配置”中看到您的项目。

回答by cmbryan

In eclipse there are different categories of run configurations. "Eclipse Application" configs can't be used to create runnable jars. You need to have a "Java Application" configuration.

在 Eclipse 中有不同类别的运行配置。“Eclipse 应用程序”配置不能用于创建可运行的 jar。您需要有一个“Java 应用程序”配置。

回答by myname

In Eclipse, under the file tab, choose runnable jar file under java folder, fill in information, u need a launchConfig and then u can save it

在Eclipse中,在文件选项卡下,选择java文件夹下的runnable jar文件,填写信息,你需要一个launchConfig然后你可以保存它

Good Luck!

祝你好运!