title: Java says FileNotFoundException but file exists
body: <p>I have an assignment for my CS class where it says to read a file with several test scores and asks me to sum and average them. While summing and averaging is easy, I am having problems with the file reading. The instructor said to use this syntax</p>
  <pre><code>Scanner scores = new Scanner(new File(&quot;scores.dat&quot;));
  </code></pre>
  <p>However, this throws a <code>FileNotFoundException</code>, but I have checked over and over again to see if the file exists in the current folder, and after that, I figured that it had to do something with the permissions. I changed the permissions for read and write for everyone, but it still did not work and it still keeps throwing the error. Does anyone have any idea why this may be occurring?</p>
  <p>EDIT: It was actually pointing to a directory up, however, I have fixed that problem. Now <code>file.exists()</code> returns <code>true</code>, but when I try to put it in the <code>Scanner</code>, it throws the <code>FileNotFoundException</code></p>
  <p>Here is all my code</p>
  <pre><code>import java.util.Scanner;
  import java.io.*;
  public class readInt{
          public static void main(String args[]){
                  File file = new File(&quot;lines.txt&quot;);
                  System.out.println(file.exists());
                  Scanner scan = new Scanner(file);
          }
  }
  </code></pre>