代码是:
Process p = "java -Xmx128M -version".execute()
Process p = "ls\ndir".execute()
p.inputStream.eachLine { println it}
println "error:"
p.errorStream.eachLine { println it}
然后它打印:错误:
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode)
为什么输出在errorStream,而不是inputStream?