how to open file with default editor and wait until it is closed
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5180885/catching-system-default-editor-closing-event-in-java">Catching system default editor closing event in java</a>  </p>
</blockquote>



<p>It seems I can use <code>java.awt.Desktop</code>. It will work on Windows/Mac OS X/Linux.</p>

<p>But I can't figure out how to know when the editor opened this way is closed.</p>

<p>P.S.: I just found an ugly solution: create a <code>run.cmd</code> file and put something like this in there:</p>

<pre><code>start "" /wait "d:\Test.rtf"
</code></pre>

<p>now i can start it form java:</p>

<pre><code>Process pr = Runtime.getRuntime().exec("d:/run.cmd");
pr.waitFor();
</code></pre>

<p>But I'm not happy with this because it works on Windows only, but what about Mac OS X?</p>
