Reading a file from a jar, or anywhere on the classpath?

后端 未结 2 412
情书的邮戳
情书的邮戳 2021-02-06 12:24

I\'m trying to build an application that builds a resource file into a jar, but I\'d like to have the project runnable within eclipse. I have a basic maven 2 structure for my pr

2条回答
  •  日久生厌
    2021-02-06 13:01

    Anything that is put in src/main/resources using maven2 will be placed in the root level of the jar. So the method you are currently using will satisfy both conditions. From the Maven page: http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR

提交回复
热议问题