I have a Java project,exported as a JAR file (Desktop Application) which generates a HTML file as output. The output html file, needs to read one image file, as the page's logo. The JAR application will be in say X folder. The target html file will be placed dynamically anywhere. How do I make the html,residing in someother location, access the image, inside the JAR file.
In short, how do I determine the path for the below code, for the above scenario.
java.net.URL url = getClass().getResource("image.jpg");
fw.write("<tr><td><b>"+csname+"</b></td><td> <img src = "+url.toString()+"'>/td></tr>");
works fine, when i run in eclipse. But not when exported as JAR The resultant html file,in some other folder has the code
<img src="rsrc:com/demo/dirapitoword/image.jpg">