Working on Linux, I have a program which can be called from the command line with a given file, the file contains a list of commands:
aProgram < aFile
For the last year or so I have used ProcessBuilder & StreamGobbler etc to execute the command as:
String cmd = new String[]{"/bin/sh","-c","aProgram < aFile"};
.......
.......
Works fine. But I would prefer to not to use shell, Is it possible to call the program stand alone and pass the file into the program via a Stream. I've tried writing to outputStream but no success.
String cmd = new String[]{"aProgram"};
.....
Thanks for any hints?
Edited by: rbp_osborne on May 20, 2009 9:24 AM