How to run a batch file in the servlet

Finsol123
Finsol123 used Ask the Experts™
on
Hi,
        i have run a batch file in the servlet Run method using Runtime class like   Process proc = Runtime.getRuntime().exec( aCommand );  i am getting this exception ,
Exception is access denied (java.io.FilePermission D:/dump.bat execute). could you help me for this.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
think .bat file must be called using the cmd interpreter
Runtime.getRuntime().exec("cmd /C d:\\dump.bat");

Open in new window

Author

Commented:
Runtime.getRuntime().exec("cmd /C d:\\dump.bat"); also not wirking. exception is coming like this Exception is access denied (java.io.FilePermission <<ALL FILES>> execute)
Is your servletengine running with a java SecurityManager? Under which servletengine are you running your code?
currently we are using Apache Tomcat Server and Glass fish Application server

Author

Commented:
it is working in both servers Tomcat and glassFish.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial