Setting up VisualVM in under 5 minutes

It’s hard to put a label on VisualVM – it has a profiler, but it’s more than that. It also has tools for tracking threads, interacting with garbage collection, and monitoring memory and CPU usage.

What you might not realise is that you almost certainly have VisualVM installed – it’s been included as a standard part of the JDK since Java 1.6 update 7. Further to this, it’s actually an evolution of Netbeans’s profiler, which was first introduced in 2004.

All of the major IDEs used by Java developers – with the exception of Netbeans due to its integrated profiler – can quickly be set up to use VisualVM. So here’s how to do it for IDEA and Eclipse.

IntelliJ IDEA

To set up VisualVM in Idea, first download the VisualVM Launcher jar. Open up the plugins settings page and install it by selecting ‘Install plugin from disk’.

idea1

Relaunch Idea and go to the new VisualVM Launcher settings page. Set the path to your jvisualvm.jar file which should be in your JDK’s bin folder.

idea2

Idea will now have buttons for launching or debugging with VisualVM.

 

Eclipse

Download the VisualVM launcher for Eclipse and extract it to a location of your choosing. Launch Eclipse and click ‘Help’ -> ‘Install New Software…’.

eclipse1

Click ‘Add..’, fill in a name and then click ‘Local’. Find your VisualVM launcher folder and select it.

eclipse2

If you now return to the Install Software dialog you should see the launcher feature available to install. Select it and hit Next.

eclipse3

Follow the instructions on screen and Eclipse will restart. If you now edit your run configuration you will see that multiple launchers are available – select the VisualVM launcher and you’re good to go.

eclipse4

 

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the Blog RSS.

  • Try PDF to HTML5 and SVG for Free
The following two tabs change content below.
Sam is a developer at IDRsolutions who mostly specialises in font support and conversion. He's also enjoyed working with Java 3D, Java FX and Swing. His other interests include music and game design.

Related Posts:

SamH

About Sam Howard

Sam is a developer at IDRsolutions who mostly specialises in font support and conversion. He's also enjoyed working with Java 3D, Java FX and Swing. His other interests include music and game design.

7 thoughts on “Setting up VisualVM in under 5 minutes

  1. […] Java comes with both a traditional profiler and a sampler in the form of VisualVM. I’m just going to be talking about CPU profiling, although the approaches to memory are […]

  2. Walter

    The first step did not work… It is a JetBrains plugin so no download of the jar is necessary nor is the load from disk. Just go to settings and select ‘Install JetBrains Plugin…’ and select VisualVM from list.

    W

  3. LuckyLuigi

    Will not work in Eclipse JUNO unless installed in the eclipse/plugins directory

  4. Anushree

    I am using Eclipse IDE and getting the following error when I am launching the java application using Visual VM:
    An internal error occurred during: “Launching TestNew”.
    java.lang.NullPointerException

    “TestNew” is the name of the class with main method I am trying to execute.

    please help.

  5. Yo

    Same problem here:
    An internal error occurred during: “Launching Test”.
    java.lang.NullPointerException

    Version: Juno Service Release 2
    Build id: 20130225-0426

    Any ideas?

  6. Yo

    Turned out I didn’t have visualvm on my system, downloaded it at: http://visualvm.java.net/download.html
    Then set the Window=>Preferences=>Run/Debug=>Launching=>VisualVM configuration=> exe path correctly

    Hope this helps someone else :-)

  7. M

    Thanks so much Yo!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>