"Launch Configuration" Shows up Blank When Trying to Export Runnable Jar?

81,162

Solution 1

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

Solution 2

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

Solution 3

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.

Share:
81,162

Related videos on Youtube

Justian Meyer
Author by

Justian Meyer

Graduated from Georgia Institute of Technology in Dec 2014 with degree focus on Information/Internetworks and Intelligence. Started my programming journey at 10 years old with DarkBasic and have since gone on to work at two top tech companies in Silicon Valley.

Updated on April 17, 2020

Comments

  • Justian Meyer
    Justian Meyer about 4 years

    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?

  • Justian Meyer
    Justian Meyer almost 14 years
    I don't see anything to specify the main class. The first page gives me the option of what I want to export, then the second page has the options: Launch Configuration, Export Destination, Library Handling(radio buttons), and Save as ANT Script (checkbox).
  • Justian Meyer
    Justian Meyer almost 14 years
    Worked nicely. I was trying Run > Run From the top menu until I re-read what you wrote and right-clicked the main class after pressing the + in the left sidebar to open it up.
  • matbrgz
    matbrgz over 10 years
    The launch configuration is needed to give the class path.
  • Amol Bais
    Amol Bais over 4 years
    you saved my day