JAR

It is my understanding that I can package not only java class files in a JAR but also other files like a gif or html file. When I use the setImageIcon() method on a gif that is not included in the JAR it works fine, however when I package the gif file inside of the JAR and use that same method it doesn't work. Is there a special path I need to use to access the file if it's located in the JAR only?

[410 byte] By [ugga24a] at [2007-10-1 1:31:44]
# 1

When you have an image in a .jar file, the image does not exist as a separate file on the harddisk. Therefore you cannot load it as if it was a file on its own. To make sure that an image gets loaded no matter how your application is packaged you should use the getResource method. The Swing tutorial has an explanation how:

http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html#getresource

jsalonena at 2007-7-8 1:52:26 > top of Java-index,Security,Event Handling...