Search for the article on Javaworld.com called "when Runtime.exec() won't". In short, the process' output buffer is full, and you need to read from proc.getInputStream(). The code is still trying to read from proc.getErrorStream() though.
You'll need to set up two threads to do the reading in parallel, adding to a StringBuilder object.
The Runnable code you could use:
You will have to call proc.waitFor() after starting these threads, to make sure that the threads read all contents. Afterwards, you can call getContents() to retrieve the contents and getException() to retrieve any IOException that occurred.
I have read and tried whats given in javaworld. I wonder its not because of buffer overflow but because Runtime isnt able to recognize sqlplus command.
So as a workaround i created a shell script (.bat for windows) and then wrote the sqlplus command in the script file
then i ran the script file using Runtime.exec(). It ran fine finally