VisualVM and JDK Mission Control on Mac OS

By | November 21, 2019

Given that Oracle’s Java licensing model has changed, I have uninstalled all Oracle JDKs from my computer and am using SDKMAN to download free Java JDK versions. However I did not find my favourite Java JVM monitoring tools, VisualVM and Mission Control, in any of the JDKs that I downloaded with SDKMAN.

VisualVM

VisualVM 1.4.4 about dialog.

VisualVM was the predecessor to JDK Mission Control but as of 2019 it is again actively developed and, as of writing this article, the latest version released is 1.4.4 which was released on September 26, 2019. The latest version can be downloaded from this webpage. There are binaries available for Linux, MacOS and Windows. VisualVM has been open-sourced and the GitHub repository can be found here.
Since I am using MacOS, I download the MacOS application bundle (dmg). Installation is straightforward after having mounted the dmg; just drag the VisualVM.app application to the Applications directory.
When I tried to start the newly installed VisualVM, nothing happened – it seemed like it immediately quit when being launched. When starting VisualVM from the terminal, the following message is logged to the console:

I found this strange, since when I examined the current Java version in the terminal, this was the result:

JDK Mission Control

Researching for this article, I did find not only one but two different free versions of JDK Mission Control.

Zulu Mission Control logo.

The first one is Zulu Mission Control (community builds), which is a fork of JDK Mission Control maintained by Azul Systems. Zulu Mission Control can be downloaded here. There are version for Windows, Linux and MacOS. As of writing this article, the latest version of Zulu Mission Control for MacOS is version 7.0. I did not find a source-code repository for Zulu Mission Control.
I downloaded the archive for the MacOS version, unpacked it and copied the Zulu Mission Control.app to the Applications directory.

The second one is JDK Mission Control as provided on the AdoptOpenJDK webpage. As of writing this article, the only available version is version 8.0.0 Snapshot, which is available for Windows, MacOS and Linux. Apparently the JDK Mission Control source repository can be found here, though I did not investigate the repository further.
The JDK Mission Control is installed the same way as Zulu Mission Control, except that the application is named JDK Mission Control.app.

As a final note I want to provide the link to the OpenJDK JDK Mission Control repository, which can be found here. This seems like an active repository, compared to the above JDK Mission Control repository. There are instructions for building JMC from source, if you want the absolutely latest.

When I tried to launch JDK Mission Control, the following error message was displayed and the application quit:

When I tried to launch Zulu Mission Control, I was met by a similar error message and the application quit.

So I have found and installed three different tools none of which seems to work.

Fixing VisualVM and Mission Control

The error message from VisualVM seemed to suggest that I had no JDK of version 1.8.0 or later installed despite the java -version command in the terminal telling me that I have version 11 available.
Knowing that Java installations of MacOS, as opposed to those installed by SDKMAN, are located at /Library/Java/JavaVirtualMachines/, I had a look in that directory. Somewhat surprisingly I only had JDK version 1.6 installed.

Armed with this knowledge I considered my options:

  • Modify the VisualVM and Mission Control applications as to use a JDK installed by SDKMAN.
  • Install a JDK to the /Library/Java/JavaVirtualMachines/ location.

I chose the second option, installing a JDK to /Library/Java/JavaVirtualMachines/ for the following reasons:

  • I do not want to modify VisualVM and Mission Control.
    This would force me to repeat the modifications after each time the applications are updated.
  • I want a stable JDK for these, to me, important tools.
    Stable in the sense that it is always there. To me, the SDKs I install using SDKMAN are primarily for development purposes. As such, I may, for example, remove versions of the JDK that I no longer use when developing.

After some searching, I settled on the Azul Systems Community JDK since they offer a dmg-file with an installation package. I chose Java 11 since it is a LTS version. The download web-page is available here and a direct link to the dmg-file is available here.

Installing the JDK is trivial; mount the dmg-file and double-click the pkg file in it. After the installation process had finished, I examined the /Library/Java/JavaVirtualMachines/ directory.

The /Library/Java/JavaVirtualMachines/ directory contents after having
installed the Zulu Community JDK version 11.

When I now launched VisualVM, Zulu Mission Control and the AdoptOpenJDK Mission Control all three now start properly.

Installing Plugins in VisualVM

As a final act of preparation, I also chose to install almost all the available VisualVM plugins.

  • Go to the Tools menu and select the Plugins item.
  • In the dialog that appears, I selected all the plugins except for SysTray.
    The SysTray plugin is not supported on Mac OS X.
  • Click the Install button to install the plugins.

The following picture lists all the plugins that I now have installed in VisualVM:

All the installed VisualVM plugins.

Final Words

All the three tools are now ready for use, but I think I will favour VisualVM and AdoptOpenJDK’s Mission Control. The latter since it is at version 8, compared to the Zulu Mission Control which is still at version 7.

As a note I also want to mention that the flight recorder can be used from Mission Control to record information for a JDK from, for instance, Azul Systems. Flight recorder has, as far as I know, never been a free feature of the Oracle JDK.

Happy coding!

Leave a Reply

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