How to solve java.security.AccessControlException?

2019-02-24 04:29发布

问题:

I am trying to access client's temp directory through my applet on my web project.
When I run the applet by itself, it gets the tempdir with no problem.

When I try to get it on my project using javascript and calling the applet method, I am having accessControlException on my javascript console. Also I am getting the same exception when I try to read a file under the temp directory.

This is what I see exactly:

java.security.accesscontrolexception access denied (java.util.propertypermission java.io.tmpdir read)
java.security.accesscontrolexception access denied (java.io.filepermission read)

How to solve java.security.AccessControlException?

回答1:

Simplest solution is just to sign the applet.