I know about using [Runtime.exec](http://java.sun.com/developer/JDCTechTips/2003/tt0304.html), you pass it a native program to run + arguments. If it's a regular program, you can run it directly. If it's a shell script, you have to run an external shell program like `sh` or `csh` or `cmd.exe`.

Is there some Java class (either standard or open-source) that implements a shell, meaning a program that you pass a command string or a script into, that executes commands and redirects standard I/O/err accordingly, so that you could pass a string like `foo | bar > baz.out` in, and it would run the `foo` and `bar` programs w/o having to run another executable outside of Java?

(and by shell I don't mean BeanShell or the standalone Rhino Javascript interpreter, those are Java implementations to execute Java and Javascript code. I'm talking about Java implementations to execute non-Java executables and handle the plumbing of redirecting I/O.)