This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 685
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image not loading