开发者

Eclipse: specifying classpath in Manifest when creating a runnable jar

开发者 https://www.devze.com 2023-01-07 15:26 出处:网络
I am using eclipse to create a runnable jar. During runtime my code looks through the classpath for a config file, which it reads in. However, as a runnable jar it is not finding this config file. 开发

I am using eclipse to create a runnable jar. During runtime my code looks through the classpath for a config file, which it reads in. However, as a runnable jar it is not finding this config file. 开发者_如何学Python

I guess the config file will need to exist as a seperate entity on the filesystem somewhere. How do I specify the classpath in the Manifest to include this location when eclipse creates the runnable jar?

Thanks


Ensure your config file is under an eclipse source folder:

I use

  1. src\main
  2. src\test
  3. src\resources

All three are folders, added to the Eclipse project as source folders

If I add three files (one.xml, one.properties and one.config) to the src/main/package/ folder and then export a runnable jar they all appear in the runnable jar.

0

精彩评论

暂无评论...
验证码 换一张
取 消