title: Question about System.in and stream
body: <p>Is there a way to reset System.in so I can have a fresh stream from which to have Scanner wait for input? Here is my code:</p>
  
  <pre><code>    boolean run = true;
      String commandLine = "";
      Scanner keyboard;
  
      Tokenizer arguments;
      RecursiveDescentParser parse;
  
      while (run){
          // Command prompt
          System.out.print(" ==&gt;\t");
  
          keyboard = new Scanner(System.in);
  
          while (keyboard.hasNextLine()) {
                commandLine += " " + keyboard.nextLine();
          }
  
          keyboard.close();
  
          keyboard = null;
  
          System.setIn ( new FileInputStream ( FileDescriptor.in )  ) ;
  
          System.setIn(System.in);
  
          keyboard = new Scanner(System.in);
  
          arguments = new Tokenizer(commandLine);
          commandLine = "";
          parse = new RecursiveDescentParser(arguments, false);
          run = parse.parseStartSymbol();
      }           
  } 
  </code></pre>
  
  <p>Once this program has run once, hasNextLine() will return false indefinitely prompting a question how do I solve this?  Can I reset the stream somehow?  Thank you for your help.</p>