Running a batch process from java with the following line: Process p = Runtime.getRuntime().exec("process.bat"); BufferedReader input = new BufferedReader (new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); }
The batch process hangs (only when I call it from Java). The process takes quite a lot of time when run directly from the command prompt (ie. outside Java). The Java doc gives the following info about the Process object: "some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock". -> don't know how to use this info??
If it isn't too much to ask, maybe you can read a few posts down the list. If you are really feeling ambitious you might even search the forum for the plethora of posts pertaining to this subject.
I am too facing the same problem "getRuntime().exec(cmdline) hangs subprocess" and also it seems the buffer size is limited to accept data from the subprocess when running from a java program. If you have any idea on this, just let me know how to solve this problem.