In my project , I have to interact with octave (scientific computation tool), I have to give the input and get the output from octave. So , I created a process using processbuilder class. Icreated two streams output stream and inputstream for giving input to octave process and getting output from octave process and I redirected the errorstream to inputStream , so -that, if there is any error occurs , I can directly get the output and error for corresponding input . In this case, till the time I give the octave command properly as input , then it is giving me the output correctly, suppose when an invalid octave command is given , then the process is not responding and also not terminating, and for further input (proper or improper) I am not able to get the output. Please give me a reply, very urgent.