title: getting output from executing a command multi line program
body: <p>I have an interface with eclipse Java Swing.This interface has buttons and editor pane. When I click the "compile" button, I run the command line in the background and press the editor panel area of all the results on the command line. I tried with textarea because I couldn't do it with editor pane. But now it only prints The Last Line How do I solve this problem?</p>
  
  <pre><code>btnNewButton.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
  
              Runtime rt = Runtime.getRuntime();  
  
              Process proc = null;
              try {
                  proc = rt.exec("cmd /c cd process.txt");
              } catch (IOException e3) {
                  // TODO Auto-generated catch block
                  e3.printStackTrace();
              }
  
              BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream())); 
              BufferedReader stdError = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
  
              // Read the output from the command
              System.out.println("Here is the standard output of the command:\n");
              String s = null;
  
              try {
                  while ((s = stdInput.readLine()) != null) {
  
  
  
                      textArea.setText("\n"+s);
  
  
                  }
              } catch (IOException e2) {
                  // TODO Auto-generated catch block
                  e2.printStackTrace();
              }
  
              // Read any errors from the attempted command
              System.out.println("Here is the standard error of the command (if any):\n");
              try {
                  while ((s = stdError.readLine()) != null) {
  
                      textArea.setText("\n"+s);
                      }
              } catch (IOException e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
              }
          }
  </code></pre>