you could create your own print method. In your new method you can write the output to a file and print to the screen. Then instead of calling System.out.print() in your program, just call your new method.
the command line fix AgentEL recommends is the easiest.
Another way is to make sure that none of your code references System.out literally. Make it all talk to a generic PrintWriter and then configure that PrintWriter in one spot to where you want it to go (to a file or to System.out or wherever). If you want to get fancy check out log4j. That's really the ultimate in configurable logging and output printing.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.