Accessing JAR resources

Posted by Pablo Fernandez on Stack Overflow See other posts from Stack Overflow or by Pablo Fernandez
Published on 2010-04-14T18:23:19Z Indexed on 2010/04/14 18:43 UTC
Read the original article Hit count: 154

Filed under:
|
|
|

I have a jar file with resources (mainly configuration for caches, logging, etc) that I want to distribute.

I'm having a problem with the relative paths for those resources, so I did what I've found in another stackoverflow question, which said that this was a valid way:

ClassInTheSamePackageOfTheResource.class.getResourceAsStream('resource.xml');

Sadly this does not work.

Any ideas? Thanks!

PS: Obviously I cannot use absolute paths, and I'd like to avoid environment variables if possible

© Stack Overflow or respective owner

Related posts about java

Related posts about relative-path