title: readline() returns null in Java
body: <p>I'm trying to read the stdin in my Java program. I'm expecting a series of numbers followed by  newlines, like:</p>
  
  <pre><code>6  
  9  
  1  
  </code></pre>
  
  <p>When providing the input through the eclipse built-in console, everything goes well. But when using the Windows command line, the program prints:</p>
  
  <pre><code>Received '6'.  
  Received 'null'.  
  Invalid input. Terminating. (This line is written by another function that does an Integer.parseint()).  
  </code></pre>
  
  <p>My code is:  </p>
  
  <pre><code>static String readLineFromStdIn(){  
  try{  
          java.io.BufferedReader stdin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));  
          String input = new String();  
          input = stdin.readLine();  
          System.out.println("Received '" + input + "'");  
          return(input);  
      }catch (java.io.IOException e) {  
          System.out.println(e);   
      }  
      return "This should not have happened";  
  }  
  </code></pre>
  
  <p>Any clues?</p>