I talked with a process this way on Solaris. You get the input and
output stream from the Process object. You can read from and write to
the process using those streams.

You might get away with doing it synchronously; I had to put
the reader and writer in separate threads because I was waiting for
output from the process (which might never have come) before writing
anything to the input stream.

HTH,

Rod McChesney, Korobra

Martin Hadis wrote:
>
> Hello!
>
> I have a natural language text parser which is an
> external executable and I'd like connect to it from my
> servlet.
>
> The problem is I'd like to communicate with the parser
> via it's input and output streams, sending in text via
> its input and getting parsed results via its output.
>
> That way my servlet can write to the parser's input,
> and then the parser can read in the data by just doing
> a readline();. After parsing, the parser would ideally
> output (print) the results to what it thinks is the
> screen (actually its output stream), making it
> readable by my servlet.
>
> The alternative would be to make my servlet &
> executable parser communicate via files, but that
> would be so damn inefficient.
>
> I've tried all the examples in Moss' and also on
> Hunter's book, but they only provide support for
> reading the exec()'d program's output.
>
> So here's the question:
>
> *** Has anyone written truly interactive exec() sample
> code that would work like the above, reading from the
> program's output, feeding it input, and (if possible)
> not crashing in the process?
>
> Exec() from servlets seems to be really quirky for
> many people. I find I can only execute my external
> programs if I precede their command line with
> c:\\winnt\\system32\\cmd.exe /c .
>
> If I just use the program name (parser.exe), even with
> full path, I get a createprocess error. (???)
>
> Strange, and quirky. Any help on any of the above will
> be most appreciated.
>
> Thanks
>
> -Martin
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> ___________________________________________________________________________
> 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