Sunday, August 2, 2009

How can I hide the cmd window in Java?

I'm writing a Java program with a GUI for a course assignment.





I would like to know how I can hide the cmd window so that it doesn't show when running the program, and that it closes automatically when I close the GUI window.





Thanx in advance.

How can I hide the cmd window in Java?
I think you mean the DOS prompt? Because I think most on these boards are Microsofty...





You can Java Web Start


You can launch with a double-click of a jar


You can write a launcher in C


You can write an applet and the applet launches the GUI (see inside your JDK1_6_xx --%26gt;demo --%26gt;jfc --%26gt;Java2D --%26gt; the Java2Demo.html and the companion /src, tracing the first 3 class


You can write a .bat that starts out with: java spiffyGUI


(then, I don't know the commands, but you would minimize DOS prompt, and java puts up a splash screen). The .bat approach does allow a "poor man's" desktop icon. After you create the .bat, you can change it's desktop icon.





Out of those options, the Java Web Start (JNI) is the best option, followed by the jar. Any method to hide a DOS launch puts two taskbar buttons on Mr. Windoze GUI.


No comments:

Post a Comment