I'm running a command via runtime.exec which take some time. I want to update my ProgressBar while that.
 I already get my desired systemoutput, the problem is: I get it all at once when the process is finished. And not step by step to update my ProgressBar ...
Here is some code
public Runtime rt = Runtime.getRuntime();
public Process pp;
  public doit() {
      try {
          pp = rt.exec(a_long_timed_process);
          InputStream is = pp.getErrorStream();
          InputStreamReader isr = new InputStreamReader(is);
          BufferedReader br = new BufferedReader(isr);
          String line = null;
          while ((line = br.readLine()) != null) {
              if (line.contains("In:")) {
                  int a = line.indexOf("In:");              //get a string
                  int b = line.lastIndexOf("%");            //between 
                  String lineout = line.substring(a + 3, b);//"0.00" and "99.99"
                  double nr = Double.parseDouble(lineout);  //make it a double
                  int round = (int) nr;                     //make it a usable int
                  System.out.println(round);
                  myProgressBar.setValue(round);            //UPDATE Progressbar
              }
          }
          pp.waitFor();
      } catch (IOException ex) {
          Logger.getLogger(Sox.class.getName()).log(Level.SEVERE, null, ex);
      } catch (InterruptedException ex) {
          Logger.getLogger(Sox.class.getName()).log(Level.SEVERE, null, ex);
      }
  }
every help is appreciated
Thanks in advance