I am working on making my Java application easy to deploy to other computers, and I am writing an ant script to do this. This is normal.
I am having problems loading the resources listed in the class path specified in the jar manifest file.
The folder structure is as follows:
/MyProgram.jar /lib/<dependencies> /config/configuration.xml
I canβt access my configuration.xml file with ClassLoader for life. It, together with all the dependencies, is explicitly specified in the Class-Path entry in the manifest file.
I tried many options:
this.xml = Thread.currentThread().getContextClassLoader() .getResourceAsStream(xmlName); this.xml = this.getClass().getResourceAsStream(xmlName);
With xmlName as a string of all of the following values:
"config/configuration.xml" "configuration.xml" "config.configuration.xml"
For this reason, I also have a log4j.properties file in the config directory. How can i get log4j? Other links say that it just needs to be in the classpath, and it is also explicitly specified in the jar manifest file. Can someone point me in the right direction?
Update:
Here are the actual entries from Class-Path:
Class-Path: <snip dependencies> config/configuration.xml config/log4j.properties
source share