title: Can't open file using .getResource().getPath()
body: <p>One year ago I've wrote JavaFX 2.0 application for my graduation work. But after one year pass I have a problem with code, that worked before. </p>
  
  <p>So, in code I want to get folder and list it's files:</p>
  
  <pre><code>File dir = new File(getClass().getResource("media/images/backgrounds/").getPath()); 
  File[] files = dir.listFiles();
  for (File file : files) {
      list.add(file.toURI().toString());
  }
  </code></pre>
  
  <p>and I'm getting java.lang.NullPointerException on line "for (File file : files) {"</p>
  
  <pre><code>System.out.print(getClass().getResource("media/images/backgrounds/").getPath());
  </code></pre>
  
  <p>returns
  file:/D:/JavafxApp1/JavafxApp/dist/run2054723721/JavafxApp.jar!/javafxapp/media/images/backgrounds/</p>
  
  <p>I don't want make another method for reading files from stream from JAR file.This method of getting files have worked 100% one year ago, but why it doesn't work now? Thanks!</p>