title: Scanner error with nextInt()
body: <p>I am trying to use Scanner to get an int from the keyboard, but I getting the following error:</p>
  
  <pre><code>Exception in thread "main" java.util.NoSuchElementException
      at java.util.Scanner.throwFor(Scanner.java:907)
      at java.util.Scanner.next(Scanner.java:1530)
      at java.util.Scanner.nextInt(Scanner.java:2160)
      at java.util.Scanner.nextInt(Scanner.java:2119)
      at TableReader.mainMenu(TableReader.java:122)
      at TableReader.main(TableReader.java:76)
  </code></pre>
  
  <p>This is what I have. It is independent of the rest of my program, I don't understand why this isn't working. It is declared in a method that is being called in a while loop, if that helps.</p>
  
  <pre><code>    // scan for selection
      Scanner s = new Scanner(System.in);
      int choice = s.nextInt();           // error occurs at this line
      s.close();
  </code></pre>
  
  <p>I stepped through with the debugger and narrowed the error down to:</p>
  
  <p>A fatal error has been detected by the Java Runtime Environment:
    SIGSEGV (0xb) at pc=0xb6bdc8a8, pid=5587, tid=1828186944</p>
  
  <p>JRE version: 7.0_07-b30
   Java VM: OpenJDK Server VM (23.2-b09 mixed mode linux-x86 )
   Problematic frame:
   V  [libjvm.so+0x4258a8]  java_lang_String::utf8_length(oopDesc*)+0x58</p>
  
  <p>Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again</p>