I need to generate a signature for a jar file within my application (could be standalone/web app/etc). To do that I need to get the path to the jar file. I thought that something like getClass().getResource("struts.jar").getFile() would do it but it doesn't (i.e. this throws an NPE within a struts app). The above syntax only works when you specify that the folder containing the jar is on the classpath, not the jar itself.
How can I do this without including the folder containing the jar on the classpath?