Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to read an image file which is in jar file?

843802Apr 21 2006 — edited Apr 26 2006
Can anybody kindly help me with how to read a TIF image file embedded in a jar file? I am launching my application using java web start and my application tries to copy the image file into the local directory on the client machine. right now i am placing the image file into the jar file and signing the jar file and referencing it in the href attribute of the jnlp file.
In my java code I am trying to access the image file using the following code:

ClassLoader cl = this.getClass().getClassLoader();

File base = new File(cl.getResource("image1.tif").toString());
FileUtility.copy(base,destinationFile);

But still it cannot find the image file.

Can anyone please help me out with this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 24 2006
Added on Apr 21 2006
17 comments
508 views