title: Why am I not receiving COM events via Com4J?
body: <p>I am using Com4J to interact with Microsoft Outlook. I have generated the Java type definitions as per the <a href="https://com4j.dev.java.net/tutorial.html" rel="nofollow noreferrer">Com4J tutorial</a>. Here is an example of some code that waits for the user to close an email.</p>
  
  <pre><code>// Registers my event handler
  mailItem.advise(
          ItemEvents.class,
          new ItemEvents() {
              @Override
              public void close(Holder&lt;Boolean&gt; cancel) {
                  // TODO Auto-generated method stub
                  super.close(cancel);
                  System.out.println("Closed");
              }
          }
      );
  
  // Displays the email to the user
  mailItem.display();
  </code></pre>
  
  <p>This code successfully displays the email to the user. Unfortunately, my program never prints <code>"Closed"</code> when the user closes the window.</p>