Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Applets and the fly likes images not loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "images not loading" Watch "images not loading" New topic

images not loading

philip depalo

Joined: Oct 12, 2009
Posts: 26
I load images into an applet and for all intents and purposes it appears the image has loaded, minus actually seeing an image. The size of the image is there, it says it is reading them from the java console:
Socket connection
Loaded image: http://localhost:8080/vcei_s/online/images\-1\0-1.jpg
Loaded image: http://localhost:8080/vcei_s/online/images\-1\3-CT.3007.1.jpg
Loaded image: http://localhost:8080/vcei_s/online/images\-1\5-area_photo.jpg
Loaded image: http://localhost:8080/vcei_s/online/images\-1\9-Photo_012607_003.jpg
Loaded image: http://localhost:8080/vcei_s/online/images\-1\10-temp054.jpg
Loaded image: http://localhost:8080/vcei_s/online/images\-1\11-5.jpg
Loaded image: http://localhost:8080/vcei_s/online/images\-1\16-Creek.jpg

yet still no pictures...any ideas? Could this be related to my prevous file permissions problem even though I am not receiving an error on this one? Why are the slash and backslash different in the image path? However if I copy that and paste it into my browser the image loads...
philip depalo

Joined: Oct 12, 2009
Posts: 26
So I discovered the issue with displaying the images

So I commented out the line that used File.separator to create the \ in between the directories and physically entered a "/" to denote the directories. This was all that was necessary. It seems that when the URL encodes the actual address it changes the File.separator \ to %5C which is the url code, but not when its supposed to show a directory. This also happened in one other place:

So that was the answer...
I agree. Here's the link:
subject: images not loading
It's not a secret anymore!