Launching external console application from JAVA

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-05-20T12:18:07Z Indexed on 2010/05/20 12:20 UTC
Read the original article Hit count: 251

Filed under:
|
|
|
|

Hi in a java application i need to run an external console application. With the window's ones everything is OK:

    try {
        System.out.println("Running...");
        Runtime.getRuntime().exec("notepad.exe");
        System.out.println("End.");
    }
    catch(Exception e) {
        System.out.println(e.getMessage());
      }

launches notepad successfully. But if I put "D:\MyProg.exe" or ".bat" or even "cmd.exe" (which is it PATH as notepad is) it does not work. Without any exeptions. Just:

Running...
End.

Can somebody help? Thanx.

© Stack Overflow or respective owner

Related posts about java

Related posts about external