|
Java™ by example!
|
|
|
How do I read an image from a Jar file?
Let's first create an JAR file containing an image. Assuming that you have a GIF file called test.gif, type on the command line:
This will create the file Tester.jar.
Add this jar file to your classpath:
("C:\" or wherever you put your jar file).
The following piece of code shows you how the classloader is used to locate the resource (in this case "test.gif") in the search path:
Further Information
Author of answer: Joris Van den Bogaert
Comments
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|