Hi,
    The following code runs fine from a command line application,
returning information from the exec() Process.  But when the code is
executed in a servlet, the servlet seems to hang.  The system process is
starts but can't seem to communicate with the servlet.  Is there any
reason a servlet can't read the input stream from a Process?
-----<snip>
//execute the system command.
 try {
  Runtime shell = Runtime.getRuntime();
  Process p = shell.exec( cmd);
//Get the input stream of the subprocess.
  BufferedReader in = new BufferedReader(new InputStreamReader(
p.getInputStream()));
//Get the error stream of the subprocess.
  BufferedReader err = new BufferedReader(new InputStreamReader(
p.getErrorStream()));

  String line;
  while ( ( line = in.readLine()) != null)
   System.out.println( line);

  while ( ( line = err.readLine()) != null)
   System.out.println( line);
 } catch (IOException e) { System.out.println( e.getMessage());}
---------<snip>
   Thanks

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to