title: Read files in a directory in a jar file
body: <p>I'm trying to read a folder in a jar file, it works fine when it's not in jar format, however when i jar it, it returns a nullpointerexpcetion since it's not able to find the files nor the directory</p>
  
  <p>So, here's the method i have....</p>
  
  <pre><code>public void preloadModelsTwoOLD() {
      String slash = System.getProperty("file.separator");
      File file = new File("."+ slash +"Patches" + slash+"Models"+slash);
      File[] fileArray = file.listFiles();
      for(int y = 0; y &lt; fileArray.length; y++) {
          String s = fileArray[y].getName();
         if (s != "") {
          byte[] buffer = readFile("."+ slash +"Patches" + slash+"Models"+slash+""+s);
          Model.method460(buffer, Integer.parseInt(getFileNameWithoutExtension(s)));
          //System.out.println("Read model: " + s);
         }
      }
  }
  </code></pre>
  
  <p>Basically this is in a java file inside the jar
  and the jar has this directory that has the files i need it to read</p>
  
  <p>file.java is in main folder
  main folder/classes/patches/models
  but the class file reads from the classes folder so i have it like this
  ./patches/models/+i+.dat</p>
  
  <p>any ideas as to why it's not reading it properly and how to go about fixing it so it'll work when in jar format if not both formats?
  any help is appreciated.</p>