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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why is not the process terminating after executing the command

Status
Not open for further replies.

avinash99

Technical User
Jul 16, 2003
1
IN
Hi
The process is not getting terminated after executing a command.
Should not the process get terminated automatically once the command is executed? Or should we terminate it using a separate command.
The code:
try {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(commandToExecute);
process.waitFor();
System.out.println("Exitvalue="+process.exitValue ());

is just waiting and not coming out.

pls reply asap. thx in advance
rgds
Avinash

 
Are you sure your "commandToExecute" is finishing ? Your code should exit fine ...

Try a simple command like nslookup or something to test it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top