title: getResourceAsStream not working for every class?
body: <p>I have a jar file that uses some txt files. In order to get them it uses <code>Class.getResourceAsStream</code> function.</p>
  
  <pre><code>Class A
  {
      public InputStream getInputStream(String path) throws Exception {
          try {
              return new FileInputStream(path);
          } catch (FileNotFoundException ex) {
              InputStream inputStream = getClass().getResourceAsStream(path);
              if (inputStream == null)
                  throw new Exception("Failed to get input stream for file " + path);
              return inputStream;
          }
      }
  }
  </code></pre>
  
  <p>This code is working perfectly.</p>
  
  <p>Problem is, if I define class A as <code>extends java.io.File</code>, the InputStream I get from <code>getResourceAsStream</code> is null.</p>
  
  <p>Also, if I leave class A as regular class (not inherited), and define class B as:</p>
  
  <pre><code>Class B extends java.io.File
  {
      public InputStream getInputStream(String path) throws Exception
      {
       return new A().getInputStream(path);
   }
  }
  </code></pre>
  
  <p>the returned InputStream is still null.</p>
  
  <p>What is the problem? Is there a way to access the file from the class that inherits <code>File</code>?</p>
  
  <p>Thanks,</p>