I have a jar built into a package that should receive a resource packaged with it like this:
MyBundle
-\ src
-\lib
-\MyEmbeddedJar
-\src
-\SomeClass
-\someResource.xml
I am trying to access "someResource.xml" from "SomeClass" as follows:
SomeClass.class.getResource( "someResource.xml" );
But I’m out of luck. I tried several options with added CWD (for example: ./ someResource.xml), but I just can't load this resource.
I know that the “right” way is to use Activator to return to the appropriate classloader, but the built-in jar can be used in other projects, so I would not want to add special OSGi code to it to make it play well with OSGi.
Is there any other way to load resources in OSGi agnostically from OSGi?