Re: Problem in executing shell script thru the process object
Posted By:
Anonymous
Posted On:
Thursday, April 21, 2005 08:21 AM
I don't fully understand why but in order to make this work I had read to the end of the inputStream. Also make sure you close all 3 streams. See example below. You probably want to print the ErrorStream as well to see what is going on.
String[] cmd = {"/usr/bin/ksh", "/tmp/export.ksh"};
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = in.readLine();
while(line != null) {
//System.out.println(line);
line = in.readLine();
}
in.close();
p.getOutputStream().close();
p.getErrorStream().close();
Re: Problem in executing shell script thru the process object
Posted By:
sriram_thota
Posted On:
Thursday, February 10, 2005 12:02 AM
can u please send me the piece of code.