multithreading - Lose sight of Java execution path getting output from Runtime.exec -


for reason losing sight of path of execution. disappears in 1 or both of while loops. there reason this? happens when run various commands @ command line. commandprocess object gets created , same stdinput , stderror objects have no idea what's going on.

in other words, no error or exception thrown, program sucked while loops never return.

process commandprocess = runtime.getruntime().exec(commandtext);              bufferedreader stdinput = new bufferedreader(new inputstreamreader(                     commandprocess.getinputstream()));              bufferedreader stderror = new bufferedreader(new inputstreamreader(                     commandprocess.geterrorstream()));              string soutput = "";              while ((soutput = stdinput.readline()) != null) {                 system.out.println(soutput);                 jta.insert(soutput, jta.gettext().length());                 jta.append("\n");             }              string serror = "";              while ((serror = stderror.readline()) != null) {                 system.out.println(serror);                 jta.insert(serror, jta.gettext().length());                 jta.append("\n");             } 

//end of code

it happens @ first line of while loops, in while condition block


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -