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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applet reading gif file - security problem.

Status
Not open for further replies.

ringd

Programmer
Jul 11, 2000
35
GB
Hello!

I'm trying to write a simple applet which has a button with an image (.gif) on it. The image file is in a sub-directory of the class.

When the image tries to load, I get the following... &quot;com.ms.securitySecurityExceptionEx[classname.<init>]; cannot access file image.gif&quot;

I've tried 'jar'ing all the files together (didn't work) and signing the jar (didn't work).

The code that reads the external file looks like...
imgX = Toolkit.getDefaultToolkit().getImage(strFilename);

...(where imgX is an Image instance).

I was advised to change this to the following...
imgX = app.getImage( app.getCodeBase(), &quot;Foldername/image.gif&quot; );

...which works! I would be curious to know, though, why the Toolkit class code did not work and getImage does. Also, is there a 'recommended standard' for this sort of thing with applets (considering I'm not on a JSP course for another month!).

Can anybody help?

Cheers,
Dave.

mailto:dave.ring@barclays.co.uk

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top