1

In my self signed java applet, I get following error:

uncaught exception: java.security.AccessControlException: access denied (java.io.FilePermission resources/fonts/new_font.TTF read)

resources/fonts/new_font.TTF file is packed inside jar.

I also tried Privileged methods mentioned here and here, but I'm still getting the error.

My code after alteration:

java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction() {
            public Object run() {
                FontFactory.register("resources/fonts/new_font.TTF", "new_font");
                return null;
            }
        }
);

Any help would be appreciated. Thanks.

Edit Very similar question was asked here without any answer.

Community
  • 1
  • 1
understack
  • 11,212
  • 24
  • 77
  • 100
  • make sure you have permission to that font from native OS. try giving 777 – jmj Jan 05 '11 at 09:09
  • @org.life.java: using Cygwin on windows I set permissions to 777. Still having same problem. – understack Jan 05 '11 at 09:14
  • Dear Jan, could you perhaps poste your code, how you got it to work, I also placed everything in the PrivilegedAction and it still does not work, which means, I can not show greek letters... It works in the appletViewer, but not in the browser. I would really apreciate this. Best wishes, Julia –  Feb 09 '11 at 22:07

1 Answers1

1

I placed all the Font calls inside PrivilegedAction() and it works now.

understack
  • 11,212
  • 24
  • 77
  • 100