When using a JMX server with ephemeral port, how to get the server port number? : <p>When launching a Java application with these options:</p>

<pre><code>-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=0
-Dcom.sun.management.jmxremote.local.only=false
</code></pre>

<p>Java uses an ephemeral port, which is very useful to avoid collisions.</p>

<p>Is it possible to get the actual port (or connection URL) programmatically from within the application ?</p>
