Within resources in JAR

后端 未结 2 462
星月不相逢
星月不相逢 2020-12-21 02:47

We have a Jar-file. There are 3 folders:

1-st: META-INF

2-nd: resources

3-rd: classes

How

2条回答
  •  失恋的感觉
    2020-12-21 03:00

    You want to use ClassLoader.getResource or getResourceAsStream, both of which will allow you to read files stored within your JAR. You can access the class loader with YourClass.class.getClassLoader(). See this question for more details: Load a resource contained in a jar

提交回复
热议问题