Solved

loading local .gif files in an applet

Posted on 1998-07-24
5
145 Views
Last Modified: 2010-03-30
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?
0
Comment
Question by:wbyeats
  • 2
  • 2
5 Comments
 

Author Comment

by:wbyeats
ID: 1228159
Edited text of question
0
 
LVL 6

Accepted Solution

by:
gadio earned 50 total points
ID: 1228160
wbyeats, if you are trying to run the applet locally, then the reaing of the image is considerd a security violation. Try an put the applet and the image on the server, and addressing them through http address (http:// ... and not file:// ... ).

0
 

Author Comment

by:wbyeats
ID: 1228161
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!
0
 
LVL 6

Expert Comment

by:gadio
ID: 1228162
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.

0
 

Expert Comment

by:goudbv
ID: 1228163
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



0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now