Link to home
Start Free TrialLog in
Avatar of Finsol123
Finsol123Flag for India

asked on

How to run a batch file in the servlet

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.
Avatar of roemelboemel
roemelboemel

think .bat file must be called using the cmd interpreter
Runtime.getRuntime().exec("cmd /C d:\\dump.bat");

Open in new window

Avatar of Finsol123

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Finsol123
Finsol123
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
it is working in both servers Tomcat and glassFish.