Input redirection in Java
I've a perl script called process.pl which I use to invoke through unix client as shown below:
$ process < abc.txt
Now, abc.txt contains entries per line which is processed by this perl script.
I want to invoke this process script through Java. I've captured the input which is required for this script in StringBuffer. My question is how do I pass this input which I stored in stringbuffer to this script?
I've tried below command, but it takes only 1st string within my Stringbuffer.
Stringbuffer str; // This contains line by line input which is required for script
Runtime.getRuntime().exec("process " + str);
But the above code executes & parses only 1st line in my stringbuffer. Can any one provide me the code which will take all input from this stringbuffer & pass it to process script??
Please note that I DO NOT want to create a file & then pass it to script.
Thanks in Advance!