2

As I understood, I need to make a jar file in order to get the .exe.

My problem: I have the method:

public static void main(String[] args){

in EX1 class. When I make: Export --> Java --> Runnable Jar file, the class EX1 is not one of my options. What can be the reason?

Thanks

Community
  • 1
  • 1
Adam Sh
  • 8,137
  • 22
  • 60
  • 75
  • You need to have run it at least once to create a launch profile first. – Thorbjørn Ravn Andersen Feb 28 '12 at 07:58
  • *"As I understood, I need to make a jar file in order to get the .exe.:"* No, you could always start with .Net based source. In fact, if all I wanted was an exe, I'd be looking to .Net. The best way to make a distributable *Java* app. is to Jar the classes and launch them with [Java Web Start](http://stackoverflow.com/tags/java-web-start/info), which will work on Windows, OS X & *nix. – Andrew Thompson Feb 28 '12 at 10:41

2 Answers2

6

Java doesn't have exe files; you'll have a runnable jar; a xxx.jar file. You can execute it as follows:

java -jar xxx.jar

also, to be able to export the runnable jar, you might have to make a run configuration first...it's somewhere in the menu or icon shortcuts of eclipse

Tom
  • 4,096
  • 2
  • 24
  • 38
  • Sorry, But I stiil don't understand. I do the next steps: press Run--> Run configuration --> press run. It's really run the program, but where is the .jat file? – Adam Sh Feb 28 '12 at 07:37
0

just to put things clear: An Jar file ist not an exe!

To your problem: Eclipse will only provide you the class in the drop down list if you had run these main class at least once directly from eclipse.

These means: Run As / Java Application

After that the class should appear in the drop down list.

StaticBR
  • 1,019
  • 1
  • 11
  • 25