title: Setting the classpath for a Spring PropertyPlaceholderConfigurer bean
body: <p>I've been looking at the questions related to Spring <code>PropertyPlaceholderConfigurer</code> beans and the associated classpaths, but so far have been unable to resolve my issue. I'm doing some changes to an older program called <code>myApp</code>, which runs as a Jar and has an external properties file called <code>myApp.properties' file, which lives in a directory called 'config' within my application directory. In the</code>applicationContext.xml' file for `myApp' I have a bean defined to read in this external properties file:</p>
  
  <pre><code>&lt;bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
  &lt;property name="locations"&gt;
    &lt;list&gt;
      &lt;value&gt;classpath:myApp.properties&lt;/value&gt;
    &lt;/list&gt;
  &lt;/property&gt;
  </code></pre>
  
  <p></p>
  
  <p>This application works just fine when built and run within Netbeans, because I include the <code>config</code> folder along with all the JAR dependencies for builds and runs. But when I try to run it from the command line using <code>java -jar myApp.jar</code>, I get the following error:</p>
  
  <pre><code>08/01/2016 15:37:18.562 | ERROR | Unable to start the application. | org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [myApp.properties] cannot be opened because it does not exist
  </code></pre>
  
  <p>I get that I need to specify the classpath correctly so that Spring knows where to find the properties file, but I'm not sure exactly how to do so, so any pointers would be appreciated...</p>