You launch a java program from a console (maybe using a .bat script). I don't want the console to remain visible, I want to hide it.
Is there a simple way to do this ? Without JNI ?
Thanks.
You launch a java program from a console (maybe using a .bat script). I don't want the console to remain visible, I want to hide it.
Is there a simple way to do this ? Without JNI ?
Thanks.
Use javaw.
http://java.sun.com/javase/6/docs/tooldocs/windows/java.html
The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don't want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason.
You can hide the console by using javaw.exe (java without) instead of using java.exe.
One of the most useful associations to set up is to make *.jar files executable with java.exe. Then you can just type the name of the jar on the command line to start it executing.
If you use javaw.exe rather than java.exe you won’t see the console output. Watch out, Java installers often associate *.jar files with javaw.exe instead of java.exe, overriding your setting.
This .bat trick works for general programs so I think it should also work for launching java program:
Call start program
instead of just program
in your .bat script
Thanks : writing start javaw ...
in the batch file instead of java ...
worked just fine !
In case fo running from but file your script should look like
start javaw start javaw -jar ***.jar
u can start the java with "start javaw". It will hide black console window.