4

I made a Java project with Eclipse. The project has a public static void main(String[] args) method in it. When I try to export it to a runnable jar, the launch configuration does not include the project I created so I can't create the jar for the project. Any ideas why?

CodeMonkey
  • 11,196
  • 30
  • 112
  • 203
  • 1
    what is the error message when you attempt to run `java -jar yourExecutable.jar` – jmj Aug 13 '13 at 20:35
  • I would install the M2E plugin for Eclipse, convert the project to Maven, and configure Maven to build the .jar for you instead. – djangofan Aug 13 '13 at 20:37

3 Answers3

16

Try creating a new launch configuration from scratch:

  1. Run -> Run Configurations...
  2. Right click "Java Application" in the list on the left and select New
  3. On the right enter a descriptive name.
  4. In the Main tab browse for your project and search for and select the appropriate main class.
  5. Close the dialog.

Now try exporting your runnable JAR again using that run configuration.

ItamarG3
  • 4,092
  • 6
  • 31
  • 44
Jason C
  • 38,729
  • 14
  • 126
  • 182
4

Either run the project once to automatically create a run configuration or go into the project options and create one manually.

Xabster
  • 3,710
  • 15
  • 21
0

One more answer, in hope it will help some one:
I had a situation where the configuration did appear in the Run -> Run Configurations list,
but did not appear on the list of the Ruannable JAR export wizard.
It was cured only after I closed and re-launched Eclipse.

c0der
  • 18,467
  • 6
  • 33
  • 65