Adding external .properties files to a MANIFEST classpath

Hi all;

I want to package my application as an executable jar (let's call it app.jar), but leave the config (.properties) file outside of it, so it can easily be edited after deployment. The config file should be added to the classpath, so that it can be loaded with ClassLoader.getResourceAsStream().

However, even though I add the directory where the config file lives to the classpath in the manifest of app.jar, it is not found by getResourceAsStream(). But if I package the config file in a separate jar (config.jar), and adds config.jar to the classpath of app.jar's manifest, it works.

Could someone explain why the config file is not picked up when not in a jar?

[697 byte] By [vramdala] at [2007-11-27 11:59:08]
# 1

Does your jar manifest file conform to the following statement from the jar specification?

Class-Path :

The value of this attribute specifies the relative URLs of the extensions or libraries that this application or extension needs. URLs are separated by one or more spaces. The application or extension class loader uses the value of this attribute to construct its internal search path.

Post the contents of the manifest file.

ChuckBinga at 2007-7-29 19:23:53 > top of Java-index,Desktop,Deploying...
# 2

Hmmm, it works now. Don't know why I couldn't get it to work in the first place. Thanks for your reply!

vramdala at 2007-7-29 19:23:53 > top of Java-index,Desktop,Deploying...