This is the well known problem of loading resources from a jar file. This is not the first time I've tried to do this, but now it doesn't work the way I expect it to.
Normally I try to load the Resources with this.getClass.getResource("foo.png")
, or getResourceAsStream()
and it works. Now however it does not. The Resource is always null.
If I let System.out.println(this.getClass.getResource(""))
print me the path (from eclipse) it shows /path/to/eclipseproject/package/structure/
. Running this from a jar it just shows rsrc:package/structure
If I recall correctly this should print the path to the jar. Furthermore I thought this would print the package structure in both cases. Am I doing something wrong?