Response from Mark:
Allow me to elaborate on the problem i'm having:
i've written a game JApplet which uses 3rd party gif's & jpg's. When testing it using appletviewer there were no problems, but when i tried testing it with a browser (IE6), the following occurs: in the status bar i get this message: "Applet MasterMind not inited" and a big red X in the top left-hand corner of the browser window.
Then, looking in the Java Console, i see this error:
java.security.AccessControlException: access denied (java.io.FilePermission mastermindchair.jpg read)
All the image files needed by the applet are located in the same directory as the compiled class files. The html to trigger the applet is in the same directory:
<html>
<applet code="MasterMind.class" width=800 height=750 alt="JVM deactivated."></applet>
</html>
Tonight, i tried lowering the security level of my browser to nil, and it still refuses to start it, always reporting the errors mentioned above. I can't understand why i can't get my machine's browser to fire up the applet , especially when i have set the security to virtually zero. BTW, i also tried using Netscape, with the same results. Any suggestions gratefully received...
The browser security settings have no bearing on this - it's the applet security settings that prohibit it. Applets can't open files (or use anything in the java.io package, and a number of other things). The appletviewer is special in this regard, as it generally doesn't enforce these restrictions; but browsers do.
There are three ways around this. Either relax the security policy for applets on your machine, or digitally sign the applet, or load the images in a way the applet is allowed to do. The first two methods are described in
this FAQ page. The third one has a short blurb and link pointing to further information on the
Applet FAQ page.
[ February 07, 2006: Message edited by: Ulf Dittmer ]