title: FileNotFoundException when creating a Scanner in Eclipse with Java
body: <p>I'm getting a FileNotFoundException when running the following Java 6 code on Eclipse (Indigo) on Snow Leopard:</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  
  public class readFile {
  
      public static void main(String[] args) {
  
          Scanner s = new Scanner(new FileReader("/Users/daniel/pr/java/readFile/myfile.txt"));  // Line 9
  
      }
  }
  </code></pre>
  
  <p>The exception is</p>
  
  <pre><code>Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
      Unhandled exception type FileNotFoundException
  
      at readFile.main(readFile.java:9)
  </code></pre>
  
  <p>My current workspace is /Users/daniel/pr/java. It contains only one project (readFile), and the file hierarchy looks like this:</p>
  
  <pre><code>- readFile
      - src
          - (default package)
              - readFile.java
      - JRE System Library [JavaSE-1.6]
      - myfile.txt
  </code></pre>
  
  <p>After reading several very similar questions, I've tried</p>
  
  <ul>
  <li>placing copies of myfile.txt in the project, bin, src, and workspace directories, as well as my home and root folders</li>
  <li>identifying the working directory and using a relative path</li>
  <li>manually setting the workspace via "Run Configurations > Arguments > Working Directory" in Eclipse</li>
  <li>running the program with the command line Java launcher in the bin, readFile, src, and java directories (with copies of myfile.txt in all of these places)</li>
  <li>removing the file extension and/or lengthening the filename (above some supposed minimum character limit), and</li>
  <li>verifying the permissions of myfile.txt (they're now rw-r--r--).</li>
  </ul>
  
  <p>I'm at a loss. What could be the problem? (Thank you for reading!)</p>