title: How to specify test classpath in Eclipse
body: <p>I have an Eclipse project with the following directory structure:</p>
  
  <pre><code>MyProj
      &gt;&gt; src/main/java
      &gt;&gt; src/main/config
      &gt;&gt; src/test/java
      &gt;&gt; src/test/config
  </code></pre>
  
  <p>Inside <code>src/test/config</code> I have a properties file called <code>app.properties</code> full of properties that both the classes in <code>src/main/java</code> and <code>src/test/java</code> use.</p>
  
  <p>All the code that I am using to look for the properties file looks like this:</p>
  
  <pre><code>try {
      Properties props = new Properties();
  
      props.load(new FileInputStream("app.properties"));
  
      someString = props.getProperty("app.title.color");
      // etc.
  } catch(Exception exc) {
      // Handle exception...
  }
  </code></pre>
  
  <p>However when I run this I am getting the following error (handled inside the <code>catch</code> clause above):</p>
  
  <blockquote>
    <p>java.io.FileNotFoundException:
    app.properties (The system cannot find the file specified)</p>
  </blockquote>
  
  <p>But when I move the <code>app.properties</code> file to my project root (at the same level as, say, <code>src/main/java</code>) and re-run the code, it works great.</p>
  
  <p>Obviously, this is a classpath issue. If I go to <code>Build Path &gt;&gt; Configure Build Path &gt;&gt; Source</code> I see that <code>src/test/config</code> is in fact a source folder on the <em>build path</em>. Which may not mean its also on the <em>class path</em>!!!</p>
  
  <p><strong>How can I configure Eclipse to look for <code>src/test/config</code> on the class path so that I can place my properties file in there but still have it available at runtime (when I run unit tests)?</strong></p>
  
  <p>Thanks in advance!</p>