I've created a .jar file that contains a single resource (XML) file and I've placed it in a folder specified in my application's classpath. In my code (within a class in a different jar) I can build a URLClassLoader
object with the 'resource' jar's URL but it looks to be empty (no packages, no classes).
I know how to access resources from a .jar using getResourceXXX
methods but I'm obtaining null
. I can get the classloader for the .jar where the resource is, but the resource seems to not be loaded.
My question is: is that jar loaded if it doesn't hold any .class file? Is there any way to access resources in that jar?