I have made a hello world program in eclipse and I was wondering how to run it out of eclipse (not on the console). I want to run it like you would with a .exe. Is this possible?
-
This is not clear. What do you mean by "not on the console"?Oliver Charlesworth– Oliver Charlesworth2012-06-02 16:06:12 +00:00Commented Jun 2, 2012 at 16:06
-
Have a look at this article: excelsior-usa.com/articles/java-to-exe.htmlChristopheD– ChristopheD2012-06-02 16:06:39 +00:00Commented Jun 2, 2012 at 16:06
-
The console is where you run your program. (Its called the console view)Jack Trowbridge– Jack Trowbridge2012-06-02 16:07:51 +00:00Commented Jun 2, 2012 at 16:07
-
If the app. is a desktop app., you are after either an executable Jar<sup>1</sup> or Java Web Start. 1. See the Packaging Programs in JAR Files lesson & particularly Setting an Application's Entry Point.Andrew Thompson– Andrew Thompson2012-06-02 16:09:32 +00:00Commented Jun 2, 2012 at 16:09
-
Another alternative is to do this on the Command Prompt. You can read about doing it here. skylit.com/javamethods/faqs/javaindos.htmlscotch– scotch2012-06-02 16:09:34 +00:00Commented Jun 2, 2012 at 16:09
|
Show 2 more comments
1 Answer
If you exported your program as an .exe, you would only be able to run it natively on Windows (the point of Java is that it is cross platform). You want to export it as a Runnable JAR File, which should be one of the export options in Eclipse:

By default, no console window will be opened when you try to open your JAR file, so any calls to System.out or System.err will be invisible. You can either run your JAR file through command prompt (java -jar YourJarFile.jar) or create a GUI for your user to interact with.