You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Martin Mauri <mm...@profesi.com.ar> on 2003/09/10 17:37:05 UTC

Running external processes...

Hi,

I'm building a webapp with JSP and I need to run an external shell process
on Linux...I don't know if this is implemented by the Servlet/JSP API , can
I call it in the normal way like "System.exec()"?? or it won't worj?

thanks!

Martin


Re: Running external processes...

Posted by "Christopher St. John" <ck...@distributopia.com>.
Martin Mauri wrote:

> 
> I'm building a webapp with JSP and I need to run an external shell process
> on Linux...I don't know if this is implemented by the Servlet/JSP API , can
> I call it in the normal way like "System.exec()"?? or it won't worj?
> 

  It depends on the security settings. Out of the box on Tomcat, it
shouldn't be a problem. Will you be administering the servlet container?

  In any case, I'd recommend writing a quick servlet or JSP that
does a System.exec(), just a "hello world" kind of thing, to get the
hang of it. You need to be careful to do things like drain the output
stream from the process, otherwise it might hang. Permissions and
paths can also be a bit tricky, but a quick google for "System.exec()"
ought to get you some informative hits. Keep in mind when you test
that the final deployment environment could be quite different than
your test environment (different user running Tomcat, different paths,
etc)

-cks