Just like Pietu1998 said, javaw.exe
will actually run your program but not open a console window. This is because javaw.exe
is meant to run GUIs which obviously does not need a command prompt. See this question for what is the difference between java.exe
and javaw.exe
.
Even
javaw -jar HelloWorld.jar
on the command prompt will look like nothing happens. Redirect the output to a file and you'll see that your program actually ran:
javaw -jar HelloWorld.jar > HelloWorld.txt
The output of your program will be in the file HelloWorld.txt
.
Usually all java programs do not rely on just double clicking to run but come with a kind of a launcher
which prepares the environment - notably setting up the classpath - for your app an then runs it. It is platform dependent and if the platform allow to run it using double click then it will be run that way. Such a launcher could be just a simple script: .bat
, .cmd
, .sh
or an executable .exe
. For example, if you look at the folder where you have installed eclipse then you'll find a eclipse.exe
file (assuming your platform is windows). Creating such a launcher is also easy and is explained in this question.