File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html files and images

 
Aruna Raghavan
Ranch Hand
Posts: 194
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic