title: How do I grant a site's applet an AllPermission privilege?
body: <p>I'd like to specify certain applets to run with <code>java.security.AllPermission</code> on my computer (for debugging and security testing). However, I don't want to enable <em>all</em> applets that I run to have this permission. So, editing my user Java policy file (which I have ensured is the correct policy file through testing), I try to put this value:</p>
  
  <pre><code>grant codeBase "http://host_where_applet_lives/-" {
   permission java.security.AllPermission;
  };
  </code></pre>
  
  <p>This value fails when the applet tries to do something powerful (create a new Thread, in my case). However, when I put the following value:</p>
  
  <pre><code>grant {
   permission java.security.AllPermission;
  };
  </code></pre>
  
  <p>The applet is able to perform the powerful operation. The only difference is the lack of a <code>codeBase</code> attribute. </p>
  
  <p>An answer to a similar question asked here [1] seemed to suggest (but never show or prove) that <code>AccessController.doPrivileged()</code> calls may be required. To me, this sounds wrong as I don't need that call when I grant the permissions to all applets (the second example I showed). Even if this is a solution, littering the applets I run with <code>AccessController.doPrivileged()</code> calls is not easy or necessarily possible. To top it off, my tests show that this just doesn't work anyway. But I'm happy to hear more ideas around it.</p>
  
  <p>[1] <a href="https://stackoverflow.com/questions/1751412/cant-get-allpermission-configured-for-intranet-applet-can-anyone-help">Can&#39;t get AllPermission configured for intranet applet. Can anyone help?</a></p>