title: Reading a .txt file using Scanner class in Java
body: <p>I am working on a Java program that reads a text file line-by-line, each with a number, takes each number throws it into an array, then tries and use insertion sort to sort the array. I need help with getting the program to read the text file.</p>
  
  <p>I am getting the following error messages:</p>
  
  <blockquote>
  <pre><code>java.io.FileNotFoundException: 10_Random (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 insertionSort.main(insertionSort.java:14)
  </code></pre>
  </blockquote>
  
  <p>I have a copy of the .txt file in my "src" "bin" and main project folder but it still cannot find the file. I am using Eclipse by the way.</p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.Scanner;
  
  public class insertionSort {
  
  public static void main(String[] args) {
  
      File file = new File("10_Random");
  
      try {
  
          Scanner sc = new Scanner(file);
  
          while (sc.hasNextLine()) {
              int i = sc.nextInt();
              System.out.println(i);
          }
          sc.close();
      } 
      catch (FileNotFoundException e) {
          e.printStackTrace();
      }
   }
  }
  </code></pre>