title: Get a PID ( process id ) from a COM4J object
body: <p>I am using COM4J to generate MS Office documents, but some times a process stop working.</p>
  
  <p>I would like to know if there is a way to identify a PID of a application created using COM4J.</p>
  
  <p>With the process id, I will kill the process that is blocking my queue.</p>
  
  <pre><code>import com4j.Variant;
  import word._Application;
  import word._Document;
  
  public class WordDemo {
      public static void main(String[] args) {
          _Application app = word.ClassFactory.createApplication();
          app.visible(true);
  
          Integer pid = null
          //Integer pid = app.getProcessID();
  
          app.documents().add( Variant.getMissing(), false, false, true);
          app.selection().typeText("Welcome to com4j");
          app.selection().typeParagraph();
          app.selection().typeText("Your Java/COM bridging solution");
  
          System.out.println("Process ID # " + pid)
      }
  }
  </code></pre>