AccessControlException: access denied for font in jar
Submitted by Anonymous Newbie on Wed, 01/05/2011 - 18:56
In my self signed java applet, I get the following error:
uncaught exception: java.security.AccessControlException: access denied (java.io.FilePermission resources/fonts/myfont.ttf read)
Note that resources/fonts/myfont.ttf is a file contained in my jar.
- Login to post comments
Content © 2010 1T3XT BVBA

Create a PrivilegedAction
Submitted by Bruno Lowagie on Wed, 01/05/2011 - 19:03.The security policy implemented by the security manager must grant the appropriate permission to read that font file from the jar. You need to put all your font calls in a PrivilegedAction like this:
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
// place font calls here
}
}
);