title: File not found in same folder Java
body: <p>I am trying to read a file in Java. I wrote a program and saved the file in the exact same folder as my program. Yet, I keep getting a FileNotFoundException. Here is the code:</p>
  
  <pre><code>public static void main(String[] args) throws IOException {
  
          Hashtable&lt;String, Integer&gt; ht = new Hashtable&lt;String, Integer&gt;();
          File f = new File("file.txt");
          ArrayList&lt;String&gt; al = readFile(f, ht);
  }
  
  public static ArrayList&lt;String&gt; readFile(File f, Hashtable&lt;String, Integer&gt; ht) throws IOException{
      ArrayList&lt;String&gt; al = new ArrayList&lt;String&gt;();
      BufferedReader br = new BufferedReader(new FileReader(f));
      String line = "";
      int ctr = 0;
  
      }
      ...
      return al;
  }
  </code></pre>
  
  <p>Here is the stack trace:</p>
  
  <pre><code>Exception in thread "main" java.io.FileNotFoundException: file.txt (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.&lt;init&gt;(Unknown Source)
      at java.io.FileReader.&lt;init&gt;(Unknown Source)
      at csfhomework3.ScramAssembler.readFile(ScramAssembler.java:26)
      at csfhomework3.ScramAssembler.main(ScramAssembler.java:17)
  </code></pre>
  
  <p>I don't understand how the file can't be found if it's in the exact same folder as the program. I'm running the program in eclipse and I checked my run configurations for any stray arguments and there are none. Does anyone see what's wrong?</p>