f



Help with Java Runtime class - on Windows

Hi,
So when I try to run a batch file that contains the path of an
executable (specific to my project), then it runs properly, spewing out
relevant data as desired. But when I try to run the same batch file
through Java's Runtime class, then the program hangs on me. Here's the
relevant code for the program..please let me know where I'm wrong..

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class processTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
		String args2[] = {"cmd","/c","Test3.bat"};
		BufferedReader reader = new BufferedReader(new
InputStreamReader(ps.getInputStream()));
		String line = null;
		while((line = reader.readLine()) != null) {
			System.out.println(line);
		}
		} catch(Exception ioe) {ioe.printStackTrace();}
	}

}
As stated above...Test3.bat works fine..but this above program hangs on
me....
Thanks,
RS

0
4/14/2006 1:00:13 PM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

2 Replies
429 Views

Similar Articles

[PageSpeed] 55

This above program doesn't even compile.
Please show the real code you're executing.
Question: Do you execute the processTest class in the same folder as
the one where Test3.bat is located? Should work that way.

Regards

0
jfbriere (107)
4/14/2006 9:53:15 PM
yes i do that...

Thanks,
Ravi Sathyam

0
4/23/2006 4:14:56 PM
Reply: