title: How to monitor external process ran by ProcessBuilder?
body: <p>This should be rather simple, but I don't see anything helpful in <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/ProcessBuilder.html" rel="noreferrer">JavaDocs</a>.</p>
  
  <p>What I need is to run some external process from my Java code and then be able to monitor if this process has been shutdown or not. In other words, I want to be able to reliably determine whether or not my external process was not ended by user.</p>
  
  <p>If no cross platform solution exists, I will accept anything working under Linux.</p>
  
  <p>My current snippet of code:</p>
  
  <pre><code>public static void main(String[] args) {
      ProcessBuilder pb = new ProcessBuilder("some proces name");
  
      try {
          Process p = pb.start();
          // p.isRunning(); &lt;- now, that would be helpful :-)
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>