How to read an image file which is in jar file?
843802Apr 21 2006 — edited Apr 26 2006Can 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?