title: ClassLoader getResourceAsStream returns null
body: <p>My project directory structure (in Eclipse):</p>
  <pre><code>MyProject/
      src/        --&gt; &quot;source directory&quot; on Eclipse's classpath/buildpath
          com.me.myapp
              Driver
              myconfig.txt
  </code></pre>
  <p>In <code>Driver</code>, I have the following code:</p>
  <pre><code>public class Driver {
      public static void main(String[] args) {
          InputStream is = ClassLoader.getSystemClassLoader.getResourceAsStream(&quot;myconfig.txt&quot;);
          if(is == null)
              System.out.println(&quot;input stream is null&quot;);
          else
              System.out.println(&quot;input stream is NOT null :-)&quot;);
      }
  }
  </code></pre>
  <p>When I run this I get the following console output:</p>
  <pre><code>input stream is null
  </code></pre>
  <p><strong>Why?</strong> Have I placed <code>myconfig.txt</code> in an incorrect location? Am I using the ClassLoader API incorrectly? Something else?</p>