title: Why java scanner doesn't work when calling jar from cmd?
body: <p>I tried to read some data from my <em>myFile.txt</em> file. The code I use is like below:</p>
  
  <pre><code>try (Scanner scanner = new Scanner(new File("myFile.txt"))) {
          System.out.println("Start");
  
          while (scanner.hasNextLine()) {
              System.out.println("Inside");
  
              String line = scanner.nextLine();
  
              String[] attribute = line.split(",");
  
              String id = attribute[0];
              String firstName = attribute[1];
              String lastName = attribute[2];
  
              System.out.println(id + " " + firstName+ " " + lastName);
          }
          System.out.println("The end");
      }
  </code></pre>
  
  <p>When I run this code from my IDE it works fine. But when I run the <strong>jar</strong> file from the cmd window it doesn't work. Only "Start" and "The end" is shown
  on the cmd screen. So, <strong>scanner.hasNextLine()</strong> is always false.</p>