Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I hide the CMD Window? 1

Status
Not open for further replies.

ModelTrains

Programmer
Nov 12, 2002
40
US
I have an app that uses the following code to ping a remote server:

Runtime r = Runtime.getRuntime();
Process p = r.exec( "ping "+ip);

This is running in MS Windows 2000, but causes an ugly, black command window to appear over the application window. Is there a way to force it into the background, run as "minimized" or not appear at all?

Thanks in advance for your help!
 
If you make a shortcut-icon of ur app - right click on the icon and go to properties and against the run option select MINIMIZE, this will minimise the cmd window but WILL show any java window if u have.
 
Thank you, ulatif. That fixed the opening window, but my app is a utility that let's the user select a database server from a drop-down box, then press the "Test Connection" button. That button executes the code to "ping" the database server. The Runtime process creates another DOS window that I do not know how to reduce. More assistance is needed!
 
a way to reduce the cmd window that runs the java application is to run it from a batch file:

ie:
set CLASSPATH=%CLASSPATH%;myLib\someLibrary.jar
start javaw com.mypackage.MyMainClass

With that you still see briefly the DOS window appear when it starts the JRE but then it should vanish.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top