Why does my call to Runtime.getRuntime().exec("....") hang?
The Runtime.getRuntime().exec("....") call may hang, as stated in JDK's javadoc, because:
A simple solution is to just read the stream and discard it: Process proc = Runtime.getRuntime().exec("myProgram"); InputStreamReader isr = new InputStreamReader(proc.getInputStream()); BufferedReader br = new BufferedReader(isr); String line=null; while ( (line = br.readLine()) != null); More details on this and other issues of Runtime.getRuntime().exec() in When Runtime.exec() won't. -- NicolasBarriga - 15 May 2007 |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|