I am getting a java.lang.AccessControlPermission: access denied (java.lang.RuntimePermission) when trying to load an Applet. I get this using IE6, Netscape4.7, and Netscape7. My applet doesn't make any socket connections or try to read any files. It simply fails to initialize and produces a stack trace with the AccessControlException. The applet code is located in a jar file and I believe I have it listed correctly in the codebase parameter of the applet tag.
Here's the funny part. I know I can run a specific applet (and it appears to be the only one I can run). That applet is loaded on the WEB server of a Lantronix UDS-10B card. It is the applet that is used to configure the card and comes preloaded on the card. If I try to run any other applet from the Lantronix card or any other web server I get the AccessControlException
If I couldn't run the Lantronix applet I would think it was a policy problem. I am at a loss of what to look at to debug the problem. I have written many applets before and think I understand the "security sandbox" an applet runs in. Any help/guidance would be appreciated.
First off, your display name does not comply with the standard required here (which specifies that it needs to be not obviously fictitious). Please change it accordingly.
As to debugging the problem, insert System.out.println statements liberally in your init code, in order to pinpoint the line in which the exception occurs. If you figure out which line it is, post it here. You could also post the full stack trace of the exception - there may be something in it that could give us a clue.
posted 14 years ago
Thanks. I cannot put in the StackTrace (isolated network). I did, however, take another hard look at the stack trace before I keyed it all in and found the answer. I had a JFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) statement in the JFrame constructor. I did not realize that that would cause the AccessControlException - RuntimePermission exception. I removed the statement and the applet loads fine.
Thanks again for responding and pointing me in the right direction.
Grow your own food... or this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop