Discovering JMX Ephemeral Port Number for Java 9+
This question: When using a JMX server with ephemeral port, how to get the server port number? indicates that we can use sun.management.ConnectorAddressLink
with the params specified to discover the ephemeral JMX port (if we start our process with com.sun.management.jmxremote.port=0
).
However for Java 9+, these classes were made private and can no longer be accessed. Is there any way one could programmatically find which port JMX has bound to?