*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes html files and images Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "html files and images" Watch "html files and images" New topic
Author

html files and images

Aruna Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 194
Hi,
Whenever I access a resource (html files and images) in my code, I use
this.getClass().getResource("filename").
I did not put any relative/absolute paths. But my help/user manual files are online. They are html. They include the following
<img src="welcome.jpg"/><BR>
Will I be in trouble because the app will find the html file but not the image embedded in it?
Should I play it safe and get rid of the image files for screen shots?
Thanks,
Aruna.


Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I used relative paths, and used the "user.dir" property to access the HTML page, and in the main directory there was an images subdirectory that I used for the images and relative path, it worked fine.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
I packaged the whole caboodle in my jar -- yes, that included my online HTML manual and all the images used by the HTML. Works like a dream. Way to go, IMHO -- no file clutter, no dependency on locations or properties.
Remember, Java can turn jar resources into a URL (Class.getResource()/ClassLoader.getResource()) using some magic syntax with the jar pseudo-protocol. That works just fine with the Swing editor widget thingie. All I did wasHTH
- Peter
[ January 16, 2003: Message edited by: Peter den Haan ]
 
wood burning stoves
 
subject: html files and images
 
Similar Threads
JSP and deployment
JSP page not displaying the image
Deployment issue
TIF IMAGE IS NOT SHOWING UP - URGENT
Image Display problem in jasper report