aspose file tools
The moose likes Beginning Java and the fly likes Reading images from a JAR file on build path Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Reading images from a JAR file on build path" Watch "Reading images from a JAR file on build path" New topic
Author

Reading images from a JAR file on build path

Jack Bernstein
Greenhorn

Joined: Jan 13, 2010
Posts: 12
I have a jar file of a bunch of images. I'd like to be able to read an image from the file. I know how to do this if I just put the jar into my project, but how do you do this when the jar is included as a library on your build path? It doesn't seem to work the same.

Below is a test program that works if the jar is included in my project, but does not work when the jar is included in the build path.



Thanks in advance for any help!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Check out how Class.getResource and ClassLoader.getResource (and their helper methods getResourceAsStream) work.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading images from a JAR file on build path
 
Similar Threads
extracting all the contents of a jar file
Read contents of jar file given specific path
unjar a file
jar file information
How to fetch information from a JAR file