简体   繁体   中英

Eclipse: specifying classpath in Manifest when creating a runnable jar

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM