title: Exception in thread "main" java.io.FileNotFoundException: Error
body: <p>I am using Eclipse to compile and run my java codes.</p>
  
  <p><strong>Here is Error I am getting.</strong></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.util.Scanner.&lt;init&gt;(Unknown Source)
      at helloworld.main(helloworld.java:9)
  </code></pre>
  
  <p><strong>Here is my Code</strong></p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import java.util.Scanner;
  
  
  public class helloworld {
  
      public static void main(String[] args) throws IOException {
          Scanner KB = new Scanner(new File("file.txt"));
          while (KB.hasNext()) {
              String line = KB.nextLine();
              System.out.println(line);
          }
  
      }
  }
  </code></pre>
  
  <p><strong>File.txt</strong><br>
  I have created file.txt in same folder in my project.</p>