title: Problem with relative file path
body: <p>So here is my program, which works ok:</p>
  
  <pre><code>import java.io.FileReader;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.util.Scanner;
  import java.util.Locale;
  
  public class ScanSum {
      public static void main(String[] args) throws IOException {
          Scanner s = null;
          double sum = 0;
          try {
              s = new Scanner(new BufferedReader(new FileReader("D:/java-projects/HelloWorld/bin/usnumbers.txt")));
              s.useLocale(Locale.US);
  
              while (s.hasNext()) {
                  if (s.hasNextDouble()) {
                      sum += s.nextDouble();
                  } else {
                      s.next();
                  }
              }
          } finally {
              s.close();
          }
  
          System.out.println(sum);
      }
  }
  </code></pre>
  
  <p>As you can see, I am using absolute path to the file I am reading from:</p>
  
  <pre><code>s = new Scanner(new BufferedReader(new FileReader("D:/java-projects/HelloWorld/bin/usnumbers.txt")));
  </code></pre>
  
  <p>The problem arises when I try to use the relative path:</p>
  
  <pre><code>s = new Scanner(new BufferedReader(new FileReader("usnumbers.txt")));
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at ScanSum.main(ScanSum.java:24)
  </code></pre>
  
  <p>The file usnumbers.txt is in the same directory as the ScanSum.class file:</p>
  
  <pre><code>D:/java-projects/HelloWorld/bin/ScanSum.class
  D:/java-projects/HelloWorld/bin/usnumbers.txt
  </code></pre>
  
  <p>How could I solve this?</p>