Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I give a name to a VisualVM "<Unknown Application>"?

Tags:

JDK 1.6 comes bundled with a handy tool called VisualVM that lets you inspect and interact with running Java processes. One feature is that it auto-detects running JVMs on the local machine. Most are listed as " (pid xxxx)" but some have a name and an icon, like VisualVM itself and others like NetBeans (see the screenshot in this dzone article for example).

How do I inject my application name and icon into the JVM so it shows up properly in VisualVM's application list? Does my app need to be running JRE 1.6 or can I do this under 1.5 too?

like image 953
Chris Dolan Avatar asked Dec 13 '10 22:12

Chris Dolan


People also ask

How do I add apps to VisualVM?

To install a VisualVM plugin:Choose Tools > Plugins from the main menu. In the Available Plugins tab, select the Install checkbox for the plugin. Click Install. Step through and complete the plugin installer.

How do I connect to a VisualVM remote server?

Connecting to a Remote Host To add a remote host, right-click the Remote node in the Applications window, choose Add Remote Host and type the host name or IP address in the Add Remote Host dialog box. (You can also specify a display name that will be used to refer to the host when listed under the Remote node.)

What is difference between JConsole and VisualVM?

JConsole uses only JMX, but VisualVM uses other monitoring technologies like Jvmstat, Attach API and SA in addition to JMX. It can merge data from all those monitoring technologies in one place and the user does not need to think which technology he should use in particular situation.


1 Answers

I solved half of my own question via a NetBeans forum post answer. Adding a JVM command line arg of -Dvisualvm.display.name=FooBar makes VisualVM show the app as "FooBar". But I still can't figure out how to affect the icon.

UPDATE: Alas, I think I found my answer for the icon. The icons are hard-coded into VisualVM via MainClassApplicationTypeFactory in the VisualVM source, invoked from the static method ApplicationTypeFactory.getApplicationTypeFor(Application). I can't see any way to inject a new icon into VisualVM except by making a VisualVM plugin which could register a new type factory -- the Glassfish plugin does this via GlassFishApplicationTypeFactory.initialize() for example.

like image 119
Chris Dolan Avatar answered Oct 02 '22 14:10

Chris Dolan