Solved

loading local .gif files in an applet

Posted on 1998-07-24
5
149 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
javap bin 2 40
ejb example issues 3 18
ejb entity bean example 2 7
Html Table Looping (part 2) 5 27
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

792 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