0

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 getResourceXXXmethods 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?

Carlos
  • 161
  • 1
  • 11

1 Answers1

0

Yes, it will be loaded. You would access the resources just as usual by calling getResourceAsStream or findResource

Jerin Joseph
  • 1,078
  • 9
  • 17