title: Get output of terminal command using Java
body: <p>For some terminal commands, they repeatedly output. For example, for something that's generating a file, it may output the percent that it is complete. </p>
  
  <p>I know how to call terminal commands in Java using</p>
  
  <pre><code>Process p = Runtime.getRuntim().exec("command goes here");
  </code></pre>
  
  <p>but that doesn't give me a live feed of the current output of the command. How can I do this so that I can do a <code>System.out.println()</code> every 100 milliseconds, for example, to see what the most recent output of the process was.</p>