Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Running a bat file from a Tomcat servlet using the exec command

Reply
Thread Tools

Running a bat file from a Tomcat servlet using the exec command

 
 
Chris
Guest
Posts: n/a
 
      04-06-2004
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
 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      04-07-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (Chris) wrote in message news:<(E-Mail Removed). 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
exec using sh -c or directly running the command, depending on thesystem Xavier NoŽlle Ruby 7 03-02-2011 01:45 PM
Tomcat ssl servlet to servlet, private CA edavid3001@gmail.com Java 0 10-06-2005 09:03 PM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
Tomcat: POST from one servlet or internal class to another servlet Sean Clarke Java 1 01-07-2004 02:22 PM



Advertisments