Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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.

How can I get my main class to show up?

like image 876
Justian Meyer Avatar asked Jul 11 '10 19:07

Justian Meyer


People also ask

How do I export a runnable jar?

To export your project, right-click it and select Export. Select Java > Runnable JAR file as the export destination and click Next. On the next page, specify the name and path of the JAR file to create and select the Launch configuration that includes the project name and the name of the test class.

What is launch configuration in Eclipse?

A launch configuration is a description of how to launch a program. The program itself may be a Java program, another Eclipse instance in the form of a runtime workbench, a C program, or something else. Launch configurations are manifested in the Eclipse UI through Run > Run....

What is the difference between runnable jar and executable jar?

FYI: In simple terms, the difference between a JAR file and a Runnable JAR is that while a JAR file is a Java application which requires a command line to run, a runnable JAR file can be directly executed by double clicking it.

How do I run a runnable jar in Eclipse?

In Eclipse, select File → Export, then Java → Runnable JAR File. Launch Configuration identifies which program should be exported. Find the one that runs the class containing your main() method. Export Destination is the name and location of the JAR file you want to generate.


2 Answers

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

like image 90
Thorbjørn Ravn Andersen Avatar answered Sep 17 '22 15:09

Thorbjørn Ravn Andersen


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

like image 42
RickyNevada Avatar answered Sep 21 '22 15:09

RickyNevada