You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by ckl <c_...@cadservices.nl> on 2000/02/10 10:27:54 UTC
cmd.exe window does not open in apache jserv
cmd.exe window does not open in apache jserv
I need to call a dos program from a servlet running on apache jserv1.1.
I develop with Jdeveloper wich has got a built in webserver to debug servlets.
With Jdeveloper it works fine (a dos windows opens), but when I deploy it to apache it doesn't work.
The process is started, but no dos window opens. Should I change settings of jserv, is this a bug, does anyone know?
The (beta) code looks like this:
String cmd = "c:\\temp\\cmd.exe /c \"start /min /wait /b dosprogram \"";
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader lsOut = new BufferedReader (new InputStreamReader (p.getInputStream()));
BufferedReader lsErr = new BufferedReader (new InputStreamReader (p.getErrorStream()));
try {
p.waitFor();
int completionStatus = p.exitValue();
out.println( "<br>Exit Status: " + completionStatus );
}
catch( InterruptedException ex ) {
out.println( "Executable program (" + cmd + ") was interrupted." );
}
while(( line=lsOut.readLine()) != null) {
out.println("<br>lsout====>");
out.println(line);
}
while ((line2 = lsErr.readLine()) != null){
out.println("<br>Errout====>");
out.println(line2);
}
}
catch(SecurityException e) {
out.println("Security Error: " + e);
}
catch(IOException e) {
out.println("IO Error: " + e);
}
catch (Exception e) {
out.println("ls error " +e);
}