title: How do I specify a directory for properties files in a jar manifest classpath?
body: <p>I'd like to put all of the .properties files that my executable jar requires in a sub-directory off of the directory from which I will run the jar file. Currently, my MANIFEST.MF looks something like this:</p>
  
  <pre><code>Manifest-Version: 1.0
  Build-Jdk: 1.6.0_26
  Main-Class: MyMainClass
  Class-Path: . conf lib/dependency1.jar
  </code></pre>
  
  <p>If I keep my .properties files in the same directory as the jar file, everything works fine. If I move them to the <code>conf</code> sub-directory, they are not found. I've also tried specifying the paths to the .properties files directly, such as <code>conf/log4j.properties</code>.</p>
  
  <p>Is what I'm trying to do possible?</p>
  
  <p><strong>Update:</strong> Here's an example of code in my executable jar that fails:</p>
  
  <pre><code>InputStream stream = getClass().getClassLoader().getResourceAsStream("myproperties.properties");
  </code></pre>
  
  <p>When <code>myproperties.properties</code> is in the <code>conf</code> sub-directory, this statement returns a null InputStream. When <code>log4j.properties</code> is in the <code>conf</code> sub-directory, it outputs its warning message about not finding its configuration:</p>
  
  <pre><code>log4j:WARN No appenders could be found for logger (MyMainClass).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  </code></pre>