I'm a software architect/consultant in Boulder, Colorado. I started blogging at: http://wayne-adams.blogspot.com/, but have since started the new blog, Data Sceintist in Training which will cover the areas I am learning as part of my own "big data" training, including the Hadoop family, frameworks like OpenStack, the R programming language, column-oriented databases and the art of examining data sets for useful patterns. The original blog will be kept alive with Java-specific posts. Wayne is a DZone MVB and is not an employee of DZone and has posted 35 posts at DZone. You can read more from them at their website. View Full User Profile

Extending JVisualVM - More on Getting Started

  • submit to reddit

I'm not sure when this happened, but at some point the JDK-included VisualVM utility became extensible. This is really great news for me. Writing a profiler is a lot of work (although admittedly very interesting and fun). VisualVM has become such a great tool that I welcome the opportunity to add a plugin to it.

Oracle has provided a lot of information in this area, which I do recommend reading. Look at Getting Started extending VisualVM and a number of links at the bottom of that page. It helps a lot to get NetBeans if you don't already have it, as it has significant support built-in to develop VisualVM plugins.

Rather than repeating "getting started" info, I planned to produce an actual VisualVM plugin in this entry, but I ran into some issues with the "getting started" guide. So, this is a "getting started" update for NetBeans 7.0.1 users, especially those who have just installed it (as I have) and have not yet created any projects.

As usual, some things in the "getting started" guides don't turn out as expected. For example, the guides say to choose "Platform Manager" from the "Tools" menu; in my NetBeans 7.0.1 installation, there was no such menu item. It seems things have changed slightly. If you are using NetBeans 7.0.1, here is how I worked my way around the problem:

  1. "File", "New Project..."

  2. Under "Choose Project", choose "NetBeans Modules"

  3. Under "Projects", choose "Module"

  4. Click "Next"

  5. Click "Standalone Module"; the dropdown mostly likely says "NetBeans IDE 7.0.1...".

  6. Click on the "Manage..." button. This click will bring up the coveted Platform Manager.

  7. Click "Add Platform..."

  8. Now, rather than browse to the root folder of the VisualVM application and select that directory (Platform Manager won't let you use it), instead browse to the root folder of the JDK you are using in NetBeans, drill down into the lib directory, and select "VisualVM". Click "Next".

  9. If you're OK with the default name "VisualVM", click "Finish". I named mine "VisualVM 1.6u20", to identify which version I chose.

  10. The newly-added platform should be selected in the "Platforms:" dialog. Click "Close" and then in the "New Module" dialog, choose the VisualVM platform. Click "Next".

  11. Provide a Code Name Base for the project (an example is given in the dialog) and click "Finish". You will now have a new project that will be built against the registered VisualVM binary.

I noticed that once I created a project and opened it (using the above steps), the "Tools" menu in NetBeans 7.0.1 became much more populated, including a menu item called "NetBeans Platforms". Apparently it was necessary to create and open one project to populate the "Tools" menu (however, it stays populated even if you close the new project). The only problem is that I needed for it to be populated before I created my project, so that I could make it a VisualVM project. The above steps show you how to achieve this goal if you have a fresh NetBeans deployment.

Now, on to that plugin I was going to write... Coming soon.


From http://wayne-adams.blogspot.com/2011/10/extending-jvisualvm-more-on-getting.html

Published at DZone with permission of Wayne Adams, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Jaroslav Bachorik replied on Mon, 2011/10/03 - 7:40am

Hi Wayn,

what you observed was NetBeans "ergonomics" in action. The NetBeans Platforms menu item appears only after Java support has been enabled - in this case creating a new project using the Java support does the trick.

You can completely disable the ergonomics feature by downloading and installing the Java SE edition of NetBeans.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.