How could Java classes direct program messages to the system console, but error messages, say to a file?
A. The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed: Stream st = new Stream(new FileOutputStream(“output.txt”)); System.setErr(st); System.
A. The class System has a variable out that represents the standard output, and the variable err that represent the standard error device. By default, they both point at the system console. This how the standard output could be re-directed: Stream st = new Stream(new FileOutputStream(“output.txt”)); System.setErr(st); System.
Related Questions
- Exiting the Program Power Problems System Errors Error Messages Functional Problems Printing Problems Sound Problems Video Problems Exiting the RenalTouch Program How can I exit the RenalTouch program?
- How could Java classes direct program messages to the system console, but error messages, say to a file?
- How do I open Java console and/or generate log file? How do I see error messages?