当咱们在Windows控制台窗口执行程序时,输入以下命令:java
demo.exe > out.txt
就能够把demo程序的输出重定向到out.txt文件里面.blog
可是这种方法对于java和javac行不通,须要使用另一种方法:class
javac -help 2> javac.txt java -help 2> java.txt
除此以外,javac还支持另外一种形式:程序
javac -help -Xstdout xx.txt