Solved

loading local .gif files in an applet

Posted on 1998-07-24
5
156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

624 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