import java.lang.Process;
import java.io.*;
import java.io.InuputStream;
import java.io.IOException;
public class newsmail{
public static void main(String[] args) throws IOException{
String command = "java Newsworthy_RB";
Process child = Runtime.getRuntime.exec(command);
int c;
InputStream in = child.getInputStream();
while((c=in.read())!=-1){
System.out.print((char)c);
}
in.close();
command = "java Newsworthy_CA";
Process child = Runtime.getRuntime.exec(command);
InputStream in = child.getInputStream();
while((c=in.read())!=-1){
System.out.print((char)c);
}
in.close();
}
I am executing two java programs one after the other as given in the above code. If any error occurs in the first program(Newsworthy_RB), my program should terminate displaying the error. Instead it continues to the execution of second program(Newsworthy_CA).
What should be done to get the error stream... Kindly advise...