Running a bat file from a Tomcat servlet using the exec command  
Author Message
cbidwell





PostPosted: 2004-4-7 6:20:00 Top

java-programmer, Running a bat file from a Tomcat servlet using the exec command I cannot get a Tomcat servlet to execute a Windows Bat file.
Is there a particular setting in the catalina.policy file that I need
to change?
Here is a code snippet of the call:

Runtime load = Runtime.getRuntime();
Process process = load.exec("cmd.exe /c start copyFiles.bat", null,
new File("C:\\Tomcat 5.0\\webapps\\myApp\\files"));

Thanks for any help.

-Chris
 
cbidwell





PostPosted: 2004-4-8 3:50:00 Top

java-programmer >> Running a bat file from a Tomcat servlet using the exec command email***@***.com (Chris) wrote in message news:<email***@***.com>...
> I cannot get a Tomcat servlet to execute a Windows Bat file.
> Is there a particular setting in the catalina.policy file that I need
> to change?
> Here is a code snippet of the call:
>
> Runtime load = Runtime.getRuntime();
> Process process = load.exec("cmd.exe /c start copyFiles.bat", null,
> new File("C:\\Tomcat 5.0\\webapps\\myApp\\files"));
>
> Thanks for any help.
>
> -Chris

OK, I have got it working.
I needed to add some entries to the catalina.policy file to set
execute permissions on
java.lang.RuntimePermission
java.lang.Win32Process

I'm not sure if they are both needed.
-Chris