Executing in java code an external program that takes arguments

Posted by rmaster on Stack Overflow See other posts from Stack Overflow or by rmaster
Published on 2010-05-27T13:42:47Z Indexed on 2010/05/27 14:11 UTC
Read the original article Hit count: 140

Filed under:
|
|
Process p;
String line;
String path;
String[] params = new String [3];

                    params[0] = "D:\\prog.exe";
        params[1] = picA+".jpg";
        params[2] = picB+".jpg";

        try {
            p = Runtime.getRuntime().exec(params);

            BufferedReader input =
                new BufferedReader
                  (new InputStreamReader(p.getInputStream()));

              while ((line = input.readLine()) != null)
                  System.out.println(line);


              input.close();
        } catch (IOException e) {System.out.println(" procccess not read"+e);}

i don't get any error, just nothing

in cmd.exe prog.exe is working fine

What to improve in order to make this code working?

© Stack Overflow or respective owner

Related posts about java

Related posts about process