GeeCON Prague 2014*
The moose likes Applets and the fly likes Image not  loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "Image not  loading" Watch "Image not  loading" New topic
Author

Image not loading

Shalini Chandel
Ranch Hand

Joined: May 05, 2005
Posts: 115
Hi All,

i create an applet with a label attached to it. I load an image in a label:



Now when I load html file directly, applet is working perfectly fine.
i.e. d:\NewTest.html

but when i use server to display applet its giving security exception error..

http://localhost:8080/NewTest.html

How can we display image?


SCJP 1.4
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
Where does the ImageIcon() constructor try to read the image file from?
Is it from the server? That should be no problem!
Or is it from the local system? That will give you a Security exception.

Read the doc for the ImageIcon constructors and find one that will work when the image needs to come from the server. This many involve other classes such as URL.

When you get an error, please POST the FULL text of the message, don't edit it.
 
GeeCON Prague 2014
 
subject: Image not loading