tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jilles van Gurp <incom...@jillesvangurp.com>
Subject Re: Running Perl script from tomcat ( no apache ) on windows
Date Wed, 28 Sep 2005 15:41:03 GMT
alebu wrote:
> Hi!
> How to run Perl script from tomcat ( no apache ) on windows?
> It is required for AW Stats, which uses perl for generating response.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
Simply use something like this in a jsp/servlet:

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
proc.getInputStream() // std out
proc.getErrorStream() // std err

Where cmd is a String[] with at index 0 the path to the command, the 
path to perl in your case and the rest of the array the commandline 
options "param=value", "--someoption", ....

There's also a variant of the exec method where you can set env 
variables, I think.

This is all documented in the Java API of course. It might be that the 
default security manager settings in your appserver have a rule against 
executing native commands in which case you will need to tweak these 
settings.

Good luck,

Jilles

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message