title: How to load files using relative path in NetBeans
body: <pre><code>import java.io.*;
  import java.util.Properties;
  
  public class NewClass {
      public static void main(String args[]) throws IOException  {
          Properties p = new Properties();
          p.load(new FileInputStream("DBDriverInfo.properties"));
          String url=p.getProperty("url");
          String user=p.getProperty("username");
          String pass=p.getProperty("password");
          System.out.println(url+"\n"+user+"\n"+pass);
      }
  }
  </code></pre>
  
  <p>Though the file <code>DBDriverInfo.properties</code> file is in the same directory, the following exception is raised.</p>
  
  <pre><code>Exception in thread "main" java.io.FileNotFoundException: DBDriverInfo.properties (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:97)
      at NewClass.main(NewClass.java:7)
  </code></pre>
  
  <p>Relative paths work fine when compiled using <code>javac</code> in a command line interface.
  But the exception raises in NetBeans.</p>