Possible Duplicate:
ProcessBuilder redirecting output
The following code:
ProcessBuilder pb = new ProcessBuilder(new String[] {"echo", "some text", ">", "test"});
keeps returning “some text > test“.
What am I doing wrong?
EDIT:
this worked
ProcessBuilder pb = new ProcessBuilder(new String[] {"bash", "-c", "echo sometext > test"});
Try following
This is for windows
Actually ‘Echo’ is not a command its an internal command of the shell (cmd.exe) in windows and "bash" in linux or unix. So , for Unix/Linux