0

I am using the Java Visual VM command line to open remote JMX connections. I use it like this:

jvisualvm.exe --userdir "user-config" --openjmx hostname:port

This works perfectly fine. But the connection name in the view shows as hostname:port. Is there any way I can pass a logical name to this connection? I can rename the connection from the view, but it doesn't stick when I reopen. I have about 10 connections from the same hostname, so wanted to logically separate out the individual connections.

Any ideas? It would even work if can just have the names stick in the user-config.

ganeshk
  • 5,583
  • 3
  • 27
  • 31

1 Answers1

1

You can start your application with -Dvisualvm.display.name="Your_name" and your application will be named "Your_name" in VisualVM. See this and this feature requests for details. Note that you have to use VisualVM 1.3.4+ or Java VisualVM from JDK 7 Update 6 or newer.

Tomas Hurka
  • 6,723
  • 29
  • 38
  • Thanks for the response. The `-Dvisualvm.display.name="Your_name"` changes the name of the local VM it opens - not the remote JMX connection. I want to change the name of the JMX connection opened using `--openjmx`. I think the second issue you referenced solves this, but that issue doesn't say how to use this. Any ideas? – ganeshk Dec 17 '12 at 15:32
  • I just tested it and it works for me. I started Java2D with the following commandline: `java -Dvisualvm.display.name="Test_test" -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx60m -jar Java2Demo.jar`. You have to use VisualVM 1.3.4+ or Java VisualVM from JDK 7 Update 6 or newer. – Tomas Hurka Dec 19 '12 at 10:17
  • This works perfectly. I was trying to set `-Dvisualvm.display.name="Your_name"` on the VisualVm instead of the app VM before. Thanks a lot! Just for reference - is there any difference in using the standalone VisualVM versus the one bundled with the JDK? – ganeshk Dec 19 '12 at 20:19
  • VisualVM is developed at http://visualvm.java.net and it has its own releases and versioning. We take the latest stable version of VisualVM and use it as basis for Java VisualVM, which is budled with JDK. There is a table http://visualvm.java.net/releases.html, which shows which VisualVM release is the basis for Java VisualVM in respective JDK update. – Tomas Hurka Dec 20 '12 at 16:12