Hi
i am calling a
java process from my web UI. i am using runtime.exec to execute an external java program. i need to redirect the process output stream to a file. That means all the system.out and system.err should be written to a file. i dont how to redirect the p.getOutputStream() to a file. Here is the code which i am using which does not work
Process p = Runtime.getRuntime().exec("java -cp some program); BufferedOutputStream o = (BufferedOutputStream) p.getOutputStream();
String str = o.toString();
if (str !=null){
byte buf[] = str.getBytes();
OutputStream os = new FileOutputStream("syndierr.txt");
os.write(buf);
os.close();
}
Any help will be appreciated.
Rashid
[ February 04, 2006: Message edited by: Michael Ernest ]