For a java application when jmx is enabled and the port is set 0, a port will be dynamically allocated:
-Dcom.sun.management.jmxremote.port=0
What is the best way to find out what port is allocated? I managed to find it out using ps and pfiles on Solaris, hoping there is a simpler why to find it (programmatically)
Also is there a better way to assign dynamic jmx ports to java applications on the same box and keep track of them?