Solved

loading local .gif files in an applet

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web application structure 18 135
eclipse buid path vs tomcat lib path 10 49
Java: anonymous class 4 55
program arguments vs VM arguments 4 58
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

751 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