views:

33

answers:

1

Hi All,

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

A: 

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.

Syntax
yeah, the config file is in a source directory, and it's exported into the jar.
Richard
Have you tried Class.getResource("yourconfigfilename.config") to access it?
Syntax