Sunday, August 10, 2008

Java: Redirect Java Output to a File

In order to redirect the java standard output to a file, we need to use the greater-than-sign (>) character followed by a filename after java.exe on a command line.
For example:
java Hello > D:\output.txt
This will redirect the output of System.out.println() to output.txt file

No comments:


Since 26 July 2008: