Stuart White wrote:
> PrintStream out = new PrintStream(new FileOutputStream("out.txt"));
AFAICT this only affects the output of the "print()" builtin (via
Interpreter.print() and Interpreter.println()).
Bsh doesn't trap the System's "out", because that's global to the entire
VM. You'd have to redirect it yourself by doing "System.setOut()"
(outside BeanShell), but that would trap System.out.println() from
*everywhere* (inside your interpreter as well as anywhere else in your
(I wonder if it would be possible to create a fake "System" object
inside bsh that would act as a proxy for all the System APIs, but do
"the right thing" for System.out and System.err, returning
Interpreter.out and Interpreter.err).