0

IntelliJ IDEA 14.1.5

So I used File -> Project Structure -> add JarOrDirectory -> selected gpdraw.jar (which i pasted into the same folder as the project).

Now no error is thrown when I

import gpdraw.*;

However, I get this exception when I run it. Not sure what to make of it.

Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\ANISHK~1\AppData\Local\Temp\AppletPage0.html" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at java.io.File.isDirectory(File.java:844)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:82)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at sun.applet.AppletViewer.parse(AppletViewer.java:1121)
at sun.applet.AppletViewer.parse(AppletViewer.java:1092)
at sun.applet.Main.run(Main.java:156)
at sun.applet.Main.main(Main.java:98)
at sun.applet.AppletViewer.main(AppletViewer.java:1275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Any help is appreciated. Thank you!

danishanish
  • 345
  • 1
  • 3
  • 13
  • Take a look here http://stackoverflow.com/questions/10454037/java-security-accesscontrolexception-access-denied-java-io-filepermission – Ashraf Purno Oct 06 '15 at 05:32
  • I had a similar issue once in an applet and running the code in question inside a AccessController.doPrivileged did the trick. Do have a look at the API documentation http://docs.oracle.com/javase/7/docs/api/java/security/AccessController.html where you have an example on the usage. – dinukadev Oct 06 '15 at 08:56

0 Answers0