title: Ant-TestNG classpath issue: getResource can't find the file
body: <p>I got a TestNG test, that works perfectly fine on it's own. Somewhere in it I got:</p>
  
  <pre><code>URL fileName = this.getClass().getClassLoader().getResource("config.properties");
  </code></pre>
  
  <p>I'm trying to run the same test using Ant:</p>
  
  <pre><code>&lt;testng outputDir="${resultsFolder}" haltOnFailure="false"&gt;
    &lt;classpath&gt;
        &lt;fileset dir="./src/"&gt;
          &lt;include name="**/*.properties"/&gt;
        &lt;/fileset&gt;
              -----------------------------...--------------------
   &lt;/classpath&gt;
   &lt;classfileset dir="correct path here" includes="**/*.class" /&gt;
  &lt;/testng&gt;
  </code></pre>
  
  <p>I can see in debug mode that the config.properties is in the classpath. But the line at the top can not find it, it is null.</p>
  
  <p>EDIT: I solved it.The critical line actually does not search for the file in the classpath directly, it searches IN the files/folders. So, this solved my problem:</p>
  
  <pre><code>&lt;pathelement location="src/"/&gt;
  </code></pre>
  
  <p>Thanks for the help.</p>