title: Using resource files in Java
body: <p>I'm just getting into using "Java Resource Files" and i have a few questions...</p>
  
  <ol>
  <li>I am hoping to distribute my program to others and I'm assuming JAR file isn't the best way. I'd probably go about it by "converting to exe" is this good practice? what are the limitations?</li>
  <li>If I convert to an exe does it keep the resource files?</li>
  <li>I'm actually just trying to use a resource file. This file is a text file and will just save the users directories for certain files so they don't need set them up every time they open the program. is this even the best way to go about it?</li>
  <li>how do you reference the resource file in the code itself?</li>
  </ol>
  
  <p>Here is what I've done.
  created a new resource file and since I'm using Netbeans I can see its location under the files tab in the navigator it looks like this:</p>
  
  <ul>
  <li>Mainproject
  <ol>
  <li>build</li>
  <li>classes</li>
  <li>myclass</li>
  <li>resources
  <ul>
  <li>directories.txt</li>
  </ul></li>
  </ol></li>
  </ul>
  
  <p>here is how i'm trying to access it but when i debug it is coming back null.</p>
  
  <pre><code>private void getPaths()//todo
  {   
  
  try
  {
   InputStream is = getClass().getResourceAsStream("/resources/directories.txt");
  InputStreamReader isr = new InputStreamReader(is);
  BufferedReader br = new BufferedReader(isr);
  String line;
  while ((line = br.readLine()) != null) 
  {
      System.out.println(line);
  }
  br.close();
  isr.close();
  is.close();
  }
   catch(Exception e)
    {
  
      }
  }
  </code></pre>