Link to home
Start Free TrialLog in
Avatar of wbyeats
wbyeats

asked on

loading local .gif files in an applet

I have written an applet which animates gif files inside a Canvas component. However, under Netscape 4.05, I am unable to read in the images using getImage(getCodeBase(), "image.gif") etc. That is, I am getting NullPointerExceptions when I try and do anything with the images. Works fine in IE4.0 (though, as far as I know, I am only using jdk 1.02 features). Is it a security issue?
Avatar of wbyeats
wbyeats

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of gadio
gadio

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wbyeats

ASKER

So IE4 is just more lenient than its predecessor and Netscape 4.05?

So I should replace "codebase" with http://servername, instead of "."? And why do books prescribe the latter if it is a security violation? And what if I want to test the applet on a machine that is not a sever--that is, I just want to open an html file on my local hardrive and see the applet work in internet explorer 3 or Netscape 3.x, 4.x?

Set me straight, please!
No, the codebase is fine as ".". The problem is that sometimes the netscape confuses the local machine as the client machine when you load things as a file and then naturally it decides that reading from the client machine is a security violation. You can 1. test the applet with the applet viewer. 2. test with explorer. 3. test through placing the files on the server. 4. install one of the tiny free http servers on your local machine. Look as www.gamelan.com . You can find there quite a few http free servers.

Dear gadio/wbyeats
I got the similar problem. But since I want my Applet  to be web based neither of the above mentioned 4 solutions works. I read once, we can solve the problem( browsing and picking the local file from the applet,  which is in any webserver) using secured applet.
But I dont know exactly what to do.  If any of you knows please let me know.
Thanks,
Venkatesh