Inserting stdout into textArea
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Orhan_Duyar
Posted On:   Tuesday, May 15, 2001 06:42 AM

I am trying to run unix operating system command or shell script within my java program and get the stdout displayed into my textArea. It works fine. The problem I am having is I don't get anything show up on my textArea until all the output is ready. In other words, if the output lasts two minutes, and if I send the output to Systen.out.println(s) I get the output line by line, the way I want it, but if I try to get it into my textArea I have to wait for two minutes, and I get all output at once. Here is my code Process p = Runtime.getRuntime().exec(l); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((s = stdInput.readLine()) != null) { pane.append(s);    More>>

I am trying to run unix operating system command or shell script within my java program and get the stdout displayed into my textArea. It works fine. The problem I am having is I don't get anything show up on my textArea until all the output is ready. In other words, if the output lasts two minutes, and if I send the output to Systen.out.println(s) I get the output line by line, the way I want it, but if I try to get it into my textArea I have to wait for two minutes, and I get all output at once.

Here is my code


Process p = Runtime.getRuntime().exec(l);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((s = stdInput.readLine()) != null)
{
pane.append(s);
pane.append("");
}

   <<Less

Re: Inserting stdout into textArea

Posted By:   Daniel_Griffin  
Posted On:   Wednesday, September 12, 2001 02:09 PM

Try redircting the output of System.out.println by using the System.setOut method. Perhaps this will accomplish what you are trying to do.
About | Sitemap | Contact