reading GIFs from a JAR file

Richard Hammer <[email protected]>
Newsgroups gmane.org.user-groups.trijug.juglist
Message-ID <[email protected]>
I am trying to read GIF files from a JAR.  The GIFs are in a 
subdirectory in the JAR.  This JAR also contains our class files in 
other subdirectories.  This JAR is in the classpath, and classloader is 
finding the class files.

But the GIFs are not being found.  I had thought I would be able to read 
the GIF files with code like this:
   ImageIcon DNA_ICON = new ImageIcon("view/gifs/DNA18x28.gif");

where "view/gifs/DNA18x28.gif" is the path of the GIF in the JAR.
But this is not working for me.

What I find with Google suggests that I may need to open a 
java.util.jar.JarInputStream, from which I can read JarEntry(s) while 
looking for my specific GIF file.  Is it really that hard?  Is there an 
easier way?

Thanks,
Rich Hammer
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.