简体   繁体   English

尝试导出可运行的Jar时,“启动配置”显示为空白?

[英]“Launch Configuration” Shows up Blank When Trying to Export Runnable Jar?

I've gotten this to work in the past, but now whenever I choose File > Export... > Runnable JAR File and select the drop-down menu "Launch Configuration" , all I get is a blank bar. 过去,我已经做到这一点了,但是现在每当我选择File > Export... > Runnable JAR File并选择下拉菜单"Launch Configuration" ,我得到的只是一个空白栏。

How can I get my main class to show up? 如何让我的主要班级出现?

Launch configurations are presumably used because they describe the main class you want to run, and the libraries the main class needs. 大概使用了启动配置,因为它们描述了您要运行的主类以及该主类需要的库。 They are created automatically when you run your main class inside Eclipse. 当您在Eclipse中运行主类时,会自动创建它们。

In the Package Explorer panel, right-click on the class you want to have main(...) executed in and choose Run as -> Java Application to run your program. 在Package Explorer面板中,右键单击要在其中执行main(...)的类,然后选择Run as -> Java Application运行程序。

This process creates a launch configuration you can use (and save too, if you make it shared) 此过程将创建您可以使用的启动配置(如果共享,也要保存)

右键单击,以-> java应用程序身份运行

I came across this same issue today as I have many times in the past, and although I've usually corrected it as Thorbjorn has posted, for some reason it was not working for me today. 今天,我遇到了过去很多次相同的问题,尽管我通常按照Thorbjorn的建议进行更正,但由于某种原因,它对我今天不起作用。

Typically I would just browse to the project, search for the main class, and hit apply then run, but it wasn't working. 通常,我只是浏览到项目,搜索主类,然后单击Apply然后运行,但是它没有用。 Still wouldn't show main class while trying to export runnable jar. 尝试导出可运行的jar时,仍然不会显示主类。

I actually had to go run configurations, and right click on the window to the left under Java Application and click 'new'. 实际上,我必须运行配置,然后右键单击Java应用程序下左侧的窗口,然后单击“新建”。 It then created a new configuration item where I could browse to the project, and add the main class. 然后,它创建了一个新的配置项目,在这里我可以浏览到该项目,并添加主类。 Then it would show up while trying to export runnable jar. 然后它将在尝试导出可运行的jar时显示。

在此处输入图片说明

This "launch configuration" thingie is all fine and good, but you probably just want to specify a main class. 这个“启动配置”的东西很好,但是您可能只想指定一个主类。 One of the pages of the "export" dialog will let you browse for and specify that main class, without the need to go looking for an appropriate configuration. “导出”对话框的页面之一将允许您浏览并指定该主类,而无需寻找合适的配置。 That's how I do it. 这就是我的方法。


EDIT 编辑

What I do is 我要做的是

File | 档案| Export | 出口| Java | Java | Jar File Jar文件

Then I select the stuff I want exported. 然后,选择要导出的内容。

Next | 下一个| Next and I get a chance to specify my main file. 接下来,我有机会指定我的主文件。

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

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