Using runtime.exec command to run a c program under linux
Hi I am trying the following code to run a C program under linux using JSP/Java code, the program is supposed to create as outputfile a .PS (postscript file), when I try the following code, the outputfile is created but empty. It works fine when I execute the program from the command shell line. The returned exit value is 1, and not zero.
String[] cmde = {"/bin/sh", "-c", "/home2/Applications/cirdna2.3.1/cirdna"+ " "+"-inputfile /home2/tomcat401/webapps/anabench-sherif/inoutlog/45_input_211_01101846922000 -postick in -posblock out -graphout ps -goutfile /home2/tomcat401/webapps/anabench-sherif/inoutlog/45_out_211_01101846922000"};
Process p = Runtime.getRuntime().exec(cmde);
try{
int iWait = p.waitFor();
out.println ("Process Exit Value is: " + iWait);
} catch (InterruptedException exx){
out.println ("/n Error Interrupt Message is: " + exx.getMessage());
}
try {
int ireturn = p.exitValue();
out.println ("/n Exit Value is: " + ireturn);
} catch (IllegalThreadStateException exs){
out.println ("/n Error Message is: " + exs.getMessage());
}
the returned exit value is 1 not 0, so something is wrong with the process termination, but the Illegal Thread exception is never catched. The resulted ps file is empty, could anyone help me with that.
Thanks.
Sherif.

