This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Image not  loading" Watch "Image not  loading" New topic

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..


How can we display image?

SCJP 1.4
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 691
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:
subject: Image not loading
It's not a secret anymore!