title: JAVA - Simple File Reader (classes: File, Scanner, hasNextLine()) - compiled, but not work
body: <p>I have a little problem.
  I am using NetBeans, and I want to create a program, which will exchange characters in *.csv file.</p>
  
  <p>I was trying to load file on few ways, but I do not now why, it do not works</p>
  
  <p>Code is correct, it can be compiled:</p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.Scanner;
  
  public class FixRaports {
  
      public static void main(String[] args) throws FileNotFoundException {
  
          String filePath = "D:/ala.csv";
  
          File fileName = new File(filePath);
  
          Scanner scanner = new Scanner(fileName);
  
          while (scanner.hasNextLine())
          {
            line = scanner.nextLine();
            System.out.println(line);
          }
  
          scanner.close();
  
      }
  
  }
  </code></pre>
  
  <p>Of course, file "ala.csv" is existing on D:\ .</p>
  
  <p>It contains:</p>
  
  <pre><code>    Ja "lubie " - placki
  
  bo placki są fajne i "slitasne"
   """ My tez je lubimy """
  - odpowie ci 'prawie' każdy
  "placki ; placki ; ' to jest; to ! """
  </code></pre>
  
  <p>The code is correctly compiled, but when i play application, it only returns:</p>
  
  <pre><code>run:
  BUILD SUCCESSFUL (total time: 0 seconds)
  </code></pre>
  
  <p>So I tried :</p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.Scanner;
  
  public class FixRaports {
  
      public static void main(String[] args) throws FileNotFoundException {
  
          String filePath = "D:/ala.txt";
  
          File fileName = new File(filePath);
          Scanner scanner = new Scanner(fileName);
  
          String line = scanner.nextLine();
          System.out.println(line);
  
          scanner.close();
  
      }
  
  }
  </code></pre>
  
  <p>And the it returns:</p>
  
  <pre><code>run:
  Exception in thread "main" java.util.NoSuchElementException: No line found
      at java.util.Scanner.nextLine(Scanner.java:1540)
      at FixRaports.main(FixRaports.java:14)
  Java Result: 1
  BUILD SUCCESSFUL (total time: 0 seconds)
  </code></pre>
  
  <p>I do not understand, why NetBeans returns "No line found" , when file "ala.csv" contains a few lines?</p>
  
  <p>What I am doing wrong?</p>