Board index » jbuilder » problems with standard output

problems with standard output


2004-06-22 04:23:24 AM
jbuilder18
I want to capture the standard output of a console program written in C in a
JTextArea component. The code I am running is shown below. The issue I
have is: it takes inordinately long for the the first line of output to
appear; and when it does all of the ouput (about 20 lines) appears together.
This is not the case if I run the program from the DOS prompt. Any ideas
why the behavior is different when the program is run under control of a
Java program?
cycleProcess = rt.exec(command, null, currentDir);
InputStreamReader isr = new
InputStreamReader(cycleProcess.getInputStream());
batchLogReader = new LineNumberReader(isr);
outputLine = batchLogReader.readLine();
while (outputLine != null) {
outputLine = batchLogReader.readLine();
messagesTextArea.setText(messagesTextArea.getText() + "\n" +
outputLine);
messagesTextArea.paintImmediately(messagesTextArea.getBounds());
}
 
 

Re:problems with standard output

please ignore this post...it is an unintentional duplicate of a message I
put in another group.
"George" < XXXX@XXXXX.COM >wrote in message
Quote
I want to capture the standard output of a console program written in C in
a
JTextArea component. The code I am running is shown below. The issue I
have is: it takes inordinately long for the the first line of output
to
appear; and when it does all of the ouput (about 20 lines) appears
together.
This is not the case if I run the program from the DOS prompt. Any ideas
why the behavior is different when the program is run under control of a
Java program?

cycleProcess = rt.exec(command, null, currentDir);
InputStreamReader isr = new
InputStreamReader(cycleProcess.getInputStream());
batchLogReader = new LineNumberReader(isr);
outputLine = batchLogReader.readLine();
while (outputLine != null) {
outputLine = batchLogReader.readLine();
messagesTextArea.setText(messagesTextArea.getText() + "\n" +
outputLine);
messagesTextArea.paintImmediately(messagesTextArea.getBounds());
}