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... "com.ms.securitySecurityExceptionEx[classname.<init>]; cannot access file image.gif"
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(), "Foldername/image.gif" );
...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
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... "com.ms.securitySecurityExceptionEx[classname.<init>]; cannot access file image.gif"
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(), "Foldername/image.gif" );
...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