“Launch Configuration” Shows up Blank When Trying

2019-01-17 05:43发布

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.

How can I get my main class to show up?

3条回答
迷人小祖宗
2楼-- · 2019-01-17 06:18

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.

Typically I would just browse to the project, search for the main class, and hit apply then run, but it wasn't working. Still wouldn't show main class while trying to export runnable jar.

I actually had to go run configurations, and right click on the window to the left under Java Application and click 'new'. 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.

enter image description here

查看更多
Luminary・发光体
3楼-- · 2019-01-17 06:19

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 | Jar File

Then I select the stuff I want exported.

Next | Next and I get a chance to specify my main file.

查看更多
聊天终结者
4楼-- · 2019-01-17 06:24

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.

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.

This process creates a launch configuration you can use (and save too, if you make it shared)

right-click, run as->java application

查看更多
登录 后发表回答