This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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
 
Similar Threads
Adding an image to a frame
Image problem in SWING
Problem Repainting Panel
Applet, How to get the image displayed PLEASE HELP
Adding an Image to JPanel using NetBeans IDE