Loading a file relative to the executing jar file

后端 未结 2 896
被撕碎了的回忆
被撕碎了的回忆 2020-12-03 08:27

The question says it all.

The specialty in my case is that the current working directory is not the location of the jar file but c:\\Windows\\system32 (

2条回答
  •  萌比男神i
    2020-12-03 08:35

    To get Launcher.class.getResourceAsStream("/../config.xml") to work, you need to add its path to the Class-Path entry of the JAR's MANIFEST.MF file. This is the normal practice.

提交回复
热议问题