Java AccessControlException : Access Denied (Java.io.fileSystem) error while running Applet from JS
Bob Mathews
Ranch Hand
Joined: Feb 26, 2006
Posts: 43
posted
0
Hi all Ranchers,
I am trying to run an Applet from Javascript/HTML.
Applet has to run one bat file on the filesystem.
And while running Runtime.exec(), Applet is giving
java.security.AccessControlException: access denied (java.io.FilePermission C:\Project\main\win32\bin\init.bat execute)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkExec(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at ReExecutionApplet.reExecute(ReExecutionApplet.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
java.lang.Exception: java.security.AccessControlException: access denied (java.io.FilePermission C:\Project\main\win32\bin\init.bat execute)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
Now as this html containg applet has to be run by multiple users I cannot expect each of them to change the java.policy file.
Once the jar is signed I have copied the signed jar and the .crt file to the deployment folder
I have been banging my head for this error for 2-3 days now but still no luck.
Please let me know if any one of you can help me resolve this.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
When you run the applet, are you getting the little popup window that asks you to accept the certificate? If not, then the applet isn't signed correctly. Also, you don't by any chance have loose class files in the deployment directory in addition to the jar file?
The .crt file is not needed for the deployment.
I assume the discrepancy between init.cmd and init.bat is just a typo.