4

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?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Hamit Ocak
  • 91
  • 1
  • 1
  • 6
  • Possible duplicate of [Applet method calling from Javascript](http://stackoverflow.com/questions/12361369/applet-method-calling-from-javascript). Of course, this applet also needs to be digitally signed & trusted, as is implied by 4 out of 5 of SO questions involving 'applet+accesscontrolexception'. – Andrew Thompson Feb 02 '13 at 03:11

1 Answers1

2

Simplest solution is just to sign the applet.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Not enough when JS is in the mix. – Andrew Thompson Feb 02 '13 at 03:13
  • 2
    Thanks, but signing the applet was not the only thing that I had to do. I also needed to use AccessController.doPrivileged(new PrivilegedAction() { public Object run() { } }); method wherever i needed to access a file or system property. – Hamit Ocak Feb 05 '13 at 09:19