title: "java.security.AccessControlException: access denied" executing a signed Java Applet
body: <p>I have a little Java Applet and I have an annoying issue. I have <strong>signed</strong> my JAR with my own keystore using jarsigner tool (following these <a href="http://java.sun.com/developer/Books/javaprogramming/JAR/sign/signing.html" rel="nofollow noreferrer">instructions</a>).</p>
  
  <p>The Java Applet downloads a <strong>signed</strong> JAR and tries to launch it with an extended class of <a href="http://docs.oracle.com/javase/7/docs/api/java/net/URLClassLoader.html" rel="nofollow noreferrer">URLClassLoader</a>. This JAR tries to execute this line of code:</p>
  
  <pre><code>ClassLoader.getSystemClassLoader().getResource("aResource");
  </code></pre>
  
  <p>It fails with a large stack trace finished by:</p>
  
  <pre><code>Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
      at java.security.AccessController.checkPermission(AccessController.java:555)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
      at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1476)
      at test.SecondJAR.main(SecondJAR.java:8)
  </code></pre>
  
  <p>(Line 8 of test.SecondJAR corresponds to <code>getResource(...)</code> method</p>
  
  <p>When the Java Applet is launched, the user is prompted to accept the certificate if he/she trusts the publisher:</p>
  
  <p><img src="https://i.stack.imgur.com/t5qKs.png" alt="Message to the user"></p>
  
  <p>Even if I accept it, the exception occurred. Even if I install the certificate, and the prompt message is automatically accepted, the exception occurred.</p>
  
  <p>I have tried too this:</p>
  
  <pre><code>AccessController.doPrivileged(new PrivilegedAction&lt;Object&gt;() {
      public Object run() {
          ClassLoader.getSystemClassLoader().getResource("aResource");
          return null;
      }
  });
  </code></pre>
  
  <p>And it fails with the same exception.</p>
  
  <p>Any help would be appreciated!</p>