Hi there.
I am having some problems loading resources from within a jar file, and I don’t really know why…
Scenario: Project A (the “executable” project) uses project B ( lib project ).
Project B contains a class for loading resources.
It loads resources the typical way with MyClass.class.getClassLoader().getResource(…)
Now, while using Eclipse, this works great ( after setting some extra src folders. I have a src/bin setup for source files / compiled files ).
I did some basic tests, printing out various resource locations. For instance, take MyClass.class.getClassLoader().getResource(".");
In Eclipse, it rightly returns the folder from which Project A is launched. However, in the jar file, it returns null. In fact, everything I tried as a resource returned null.
Comparing the eclipse project files with the jar extracted confirms that the paths seem correct…
Anyone got an idea of what’s going on here?