Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading .gif files using ImageIcon in Applets

Status
Not open for further replies.

AndyKnappJava

Programmer
Mar 13, 2003
7
EU
Hi,

I'm trying to read in an icon for a button using the ImageIcon constructor:

ImageIcon icon = new ImageIcon( <file name> );

This is fine when the code is on my local machine or being run under AppletViewer, however when I try to run the applet through a web browser I get a:

java.security.AccessControlException: access denied(java.io.FilePermission not.gif read)

I've made sure the not.gif file has read access on my web server and that the file is in the same location as the .class file - what more do I need to do?!! :)

Thanks Andy


 
I think the security model might require signing the applet. I also think there was a recent thread in this forum regarding that subject. You might do a search for &quot;sign applet&quot; or something like that.

-pete
 
Thanks Pete,

I'm still reading through the Security in Java Trail on the sun tutorial:


but am failing to see why I need to generate a signed applet if all I'm trying to do is read a .gif file from the same location on a webserver as the applet's .class files.

Why is there a security/permissions issue here?

Are .gif files not trusted if at the same location as the .class files?

Regards Andy.
 
>> Are .gif files not trusted if at the same location as
>> the .class files?

Great question Andy. To be honest i have not had reason to keep up with the Java Applet security issue. Perhaps if you gain a solid understanding for your project you can post an explination here? Maybe even create a FAQ?

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top