Cannot run command window

In Windows I would expect to call up a seperate command window with the following, but it appears to freeze up. What am I doing wrong?

import java.io.*;

publicclass command{

publicstaticvoid main(String[]args){

try{

Process runprogram = Runtime.getRuntime().exec("C:\\windows\\system32\\cmd.exe");

try{

runprogram.waitFor();

}

catch(InterruptedException e){}

}

catch(IOException e){

System.err.println("Cannot run command window");

}

}

}

[1237 byte] By [ChrisLesliea] at [2007-11-26 20:00:44]
# 1

What about this...

Process proc = null;

try

{

proc = Runtime.getRuntime().exec("start cmd");

proc.waitFor();

}

catch(Exception e)

{

e.printStackTrace();

}

Some dukies would be nice next time ;-)

lucky_lucianoa at 2007-7-9 22:58:36 > top of Java-index,Java Essentials,Java Programming...
# 2

This will probably work better

Process proc = null;

try

{

proc = Runtime.getRuntime().exec("cmd /C start cmd");

proc.waitFor();

}

catch(Exception e)

{

e.printStackTrace();

}

lucky_lucianoa at 2007-7-9 22:58:36 > top of Java-index,Java Essentials,Java Programming...
# 3
lucky,Thanks, that was a great help.Chris
ChrisLesliea at 2007-7-9 22:58:36 > top of Java-index,Java Essentials,Java Programming...