title: Groovy Console read input
body: <p>I'm just starting to learn Groovy and I am experimenting in GroovyConsole.</p>
  
  <p>Is there a way I can read user input? I have tried the code below but I get an error.</p>
  
  <pre>BufferedReader br = new BufferedReader(new InputStreamReader(System.in))
  
  print "Input:"
  
  input = br.readLine()
  
  println "You entered: $input"</pre>
  
  <p>This is the error I am receiving:</p>
  
  <pre>Exception thrown
  17-Apr-2012 02:52:39 org.codehaus.groovy.runtime.StackTraceUtils sanitize
  
  WARNING: Sanitizing stacktrace:
  
  java.io.IOException: Stream closed</pre>
  
  <p>Is there anything I need to import?</p>
  
  <p>Any help would be great.</p>
  
  <p>Thanks</p>