2

in .net if I wanted to open a new command line window, I could just write.

     System.Diagnostics.Process.Start("cmd.exe");

in java, however, the following code does nothing:

    new java.lang.ProcessBuilder("cmd.exe").start();
    java.lang.Runtime.getRuntime().exec("cmd.exe");

No new window is created and no Process appears in Task Manager.

Now if the application I was trying to open was "notepad.exe", then java would open it just fine.

What does this mean?

J Smith
  • 2,375
  • 3
  • 18
  • 36
  • see [this](http://stackoverflow.com/questions/4688123/how-to-open-the-command-prompt-and-insert-commands-using-java) (read: probably not dupe) – Piccolo Mar 31 '13 at 20:56

1 Answers1

3
Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start"});

To learn more on start, type help start at command prompt.

Aubin
  • 14,617
  • 9
  • 61
  • 84