Rectangle 27 0

process Can't launch external program from Java without closing java app?


String cmd = "svn.exe";
Process proc = Runtime.getRuntime().exec(cmd);
BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
String line = null;
while((line=reader.readLine())!=null){
   System.out.println(line);
}
reader.close();

Thanks. I didn't need any of the error outputs in my java app as it's meant to be a silent launch so I just closed the streams and it works.

Which evidently shows the program was executed by Java.

You may also read the error output stream to check it the program is actually being unsuccessfully executed

Note
Rectangle 27 0

process Can't launch external program from Java without closing java app?


Thanks man. I closed ALL the blasted streams and it seems to work now. Process p = Runtime.getRuntime().exec(cmd.toString()); p.getInputStream().close(); p.getOutputStream().close(); p.getErrorStream().close(); Just closing the input stream didn't work for some reason.

You may need to read from the process's standard output, or close the standard input, before it will proceed. For reading the output, the problem is that the buffer can get full, blocking the program; for closing the input, the problem is that some programs will try to read data from there if it's available, waiting to do so. One or both of these tricks is very likely to straighten things out for you.

Note
Rectangle 27 0

process Can't launch external program from Java without closing java app?


String cmd = "svn.exe";
Process proc = Runtime.getRuntime().exec(cmd);
BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
String line = null;
while((line=reader.readLine())!=null){
   System.out.println(line);
}
reader.close();

Thanks. I didn't need any of the error outputs in my java app as it's meant to be a silent launch so I just closed the streams and it works.

Which evidently shows the program was executed by Java.

You may also read the error output stream to check it the program is actually being unsuccessfully executed

Note