Accessing JAR resources

前端 未结 4 1523
太阳男子
太阳男子 2020-11-30 10:47

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 path

4条回答
  •  情话喂你
    2020-11-30 11:25

    I always have to puzzle through getResourceAsStream to make this work. If "resource.xml" is in org/pablo/opus, I think you want this:

    Name.class.getResourceAsStream("org.pablo.opus.resource.xml");
    

提交回复
热议问题