Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to the hide win32 launch console from a Java program (if possible without JNI)

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 ?

like image 296
Eric Nicolas Avatar asked Nov 05 '08 09:11

Eric Nicolas


People also ask

How do I disable Java console?

If its a console app and the user is interacting with it then you ask the user to enter a value that indicates to you that they want to stop the app. If yoy are not interacting with the user at all then ctrl-c will have to work.

How do you call a console in Java?

In the Java Control Panel, click the Advanced tab. Expand the Java console option. Select Show Console and click OK.


2 Answers

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.

like image 117
johnstok Avatar answered Sep 30 '22 16:09

johnstok


You can start a java application with start javaw. It will hide the black console window.

like image 24
Manikandan Avatar answered Sep 30 '22 18:09

Manikandan