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
Jean-Francois Briere - 14 Apr 2006 22:53 GMT
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
Ivar - 23 Apr 2006 17:14 GMT
yes i do that...
Thanks,
Ravi Sathyam