Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address:

Java Tip 14: Redirecting standard streams in Java

Change input, output, and error streams

This week we show how to redirect the standard system-provided input, output, and error streams.

The stream redirection demo application shows the various steps to take to redirect all three of the standard streams to/from regular files.

The application presumes a file called Redirect.in exists. It reads that file in place of the System.in standard input stream and prints it to the original System.out standard output stream.

The application will redirect the System.out output stream and the System.err standard error stream to the Redirect.out and Redirect.err files, respectively.

Armed with this knowledge we can now go wild and write our own subclasses of the InputStream and PrintStream to add all sorts of fun behavior -- like printing things out to both the original console and a file, or maybe down a socket connection, or...

Author Bio

Subsisting on caffeine, sugar, and too little sleep, John D. Mitchell has been consulting for most of the last nine years, and developed PDA software in OO assembly language at Geoworks. He funds his Java addiction by writing compilers, Tcl/Tk, C++, and Java systems. He co-authored the hot new Java book Making Sense of Java and is currently developing a Java compiler.
Resources