Directing output to a file?

I was wondering how you can redirect your output to be viewed in something else, such as Notepad. When running the application, I cannot view all of the printed information in the program, and I need to recopy it and it would be too much of a hassle to just write them all down. Thanks for the help!

[306 byte] By [Birdboy30a] at [2007-11-26 16:44:57]
# 1
java yourProgram > outputfile.txt
hunter9000a at 2007-7-8 23:12:16 > top of Java-index,Java Essentials,New To Java...
# 2
Well, you could just write whatever you want to output to a file. Look at the BufferedWriter, FileOutputStream, and FileWriter classes.Actually, what was suggested above seems like a better idea.
Djaunla at 2007-7-8 23:12:16 > top of Java-index,Java Essentials,New To Java...
# 3
Please define "printed information in the program". Is that text output to the console? You can redirect standard output and standard error. See the methods setErr and setOut in System: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html
DrLaszloJamfa at 2007-7-8 23:12:16 > top of Java-index,Java Essentials,New To Java...
# 4
The information are two repeating variables that are only being sent to the moniter (System.out.print). And as you know you can't view but so much through the program window, and I just want to redirect that output to a file. And if you were wondering, yes I am new to this.
Birdboy30a at 2007-7-8 23:12:16 > top of Java-index,Java Essentials,New To Java...
# 5
Hunter9000 gave you the simplest solution. You can use shell redirection.
DrLaszloJamfa at 2007-7-8 23:12:16 > top of Java-index,Java Essentials,New To Java...
# 6
hi da,i have one more option for u to redirect the output during compilation.javac -Xstdout myfile1.txt myfile.javajava myfile > myfile2.txtreply me
Prajjia at 2007-7-8 23:12:16 > top of Java-index,Java Essentials,New To Java...
# 7

hi,

if you can modify that program , you can use Logger class (java.util.logging.Logger), you can redirect output to

a. console

b. file (text user defined, xml format)

c. socket

you just change the properties or config file to which redirect output that you choose.

regards

p_epi

p_epia at 2007-7-8 23:12:16 > top of Java-index,Java Essentials,New To Java...