Process requires redirected input

Posted by initialZero on Stack Overflow See other posts from Stack Overflow or by initialZero
Published on 2010-06-03T21:02:52Z Indexed on 2010/06/03 21:04 UTC
Read the original article Hit count: 131

Filed under:
|

I have a UNIX native executable that requires the arguments to be fed in like this prog.exe < foo.txt.

foo.txt has two lines: bar baz

I am using java.lang.ProcessBuilder to execute this command. Unfortunately, prog.exe will only work using the redirect from a file. Is there some way I can mimic this behavior in Java?

Of course, ProcessBuilder pb = new ProcessBuilder("prog.exe", "bar", "baz"); does not work.

Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about processbuilder