But the program logic is clearly print output, and in the CMD Windows to run the program is normal, why here with the ProcessBuilder run can only output first? I tried to modify the sequence of statements InputStream and OutputStream, still doesn't work, please help analysis.
InputStream InputStream=process. GetInputStream ();
Thread=new thread (new Runnable () {
@ Override
Public void the run () {
Try {
Int it=0;
Do {
int count=0;
While (count==0) {
Count=inputStream. Available ();
}
It=inputStream. Read ();
The d (" DDD ", "read=" + it);
} while (it!=1);
} the catch (IOException e) {
e.printStackTrace();
}
}
});
Thread. The start ();
OutputStream OS=process. GetOutputStream ();
BufferedWriter=new bufferedWriter (new OutputStreamWriter (OS));
Try {
BufferedWriter. Write (" 5 \ n ");//only for input, to perform the read above, what reason be?
} the catch (IOException e) {
e.printStackTrace();
}
CodePudding user response:
Why didn't respond