Some simpified code for creating an external process, and getting a stream
to its output.

Process p = Runtime.getRuntime().exec("c:\doit.exe");
InputStrem is = p.getInputStream();

Note:
1. The behaviour of Runtime.exec is somewhat platform-dependant so you want
to test thoroughly. (Also the servlet might not be allowed to create
external processes.)
2. Potential performance issue, as you are probably aware of. Creating
processes is expensive in most op systems, and context-switching is a
problem in NT. (Thats why we do Servlets instead of CGI. :)

Regards
/M�rten Haglind

> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Jay
> Macarty
> Sent: Thursday, February 10, 2000 4:24 PM
> To: [EMAIL PROTECTED]
> Subject: Calling a Windows Line Command from a Servlet
>
>
> I have a servlet which needs to interact with another application. The
> problem is that the application normally works from commands entered at a
> DOS prompt window. I need to be able to invoke the command and trap the
> output. I think I have seen this done before but can't remember where.
>
>
> --------------------------------------------------
> Jay Macarty - Technical Specialist
> Phone: (972) 591-7385
>
> __________________________________________________________________
> _________
> 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
>

___________________________________________________________________________
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