Apple releases Java 6 update 7 for Leopard

Today Apple released (through Software Update) an update to Java on Leopard which updates Java SE 6 to version 1.6.0_07, J2SE 5.0 to version 1.5.0_16, and J2SE 1.4.2 to 1.4.2_18.

Leopard Java update
Leopard Java update

This is great in that Apple is demonstrating its committment not only to supporting three different versions of Java on Leopard but also their respective updates. On the downside I couldn’t find the jvisualvm or visualvm executable anywhere in the various Java distributions on the mac.

To provide a little background VisualVM is an all-in-one graphical application that integrates various command line JDK tools but also provides lightweight profiling capabilities, monitoring and performance analysis facilities. With JDK6u7 it is supposed to be bundled in already. On the mac however the visualvm or jvisualvm executable is nowhere to be found so here’s what I did to get it running.

After the Software Update had completed I went into Applications » Utility » Java Preferences and switched all my Java versions to the latest v6 64-bit.

Leopard Java preferences
Leopard Java preferences

Then I checked the symbolic links were correct on the filesystem.  The CurrentJDK symbolic link was still pointing to 1.5 so I deleted it and recreated it to point to 1.6.  Here’s how the filesystem looked after the fix.

polar:~ dhruba$ cd /System/Library/Frameworks/JavaVM.framework/Versions/
polar:Versions dhruba$ ls -l
total 56
lrwxr-xr-x 1 root wheel 5 Sep 27 12:47 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Sep 29 2007 1.3.1
lrwxr-xr-x 1 root wheel 5 Sep 27 12:47 1.4 -> 1.4.2
lrwxr-xr-x 1 root wheel 3 May 3 12:25 1.4.1 -> 1.4
drwxr-xr-x 8 root wheel 272 Nov 3 2007 1.4.2
lrwxr-xr-x 1 root wheel 5 Sep 27 12:47 1.5 -> 1.5.0
drwxr-xr-x 8 root wheel 272 Nov 3 2007 1.5.0
lrwxr-xr-x 1 root wheel 5 Sep 27 12:47 1.6 -> 1.6.0
drwxr-xr-x 8 root wheel 272 May 3 12:25 1.6.0
drwxr-xr-x 8 root wheel 272 Sep 27 12:47 A
lrwxr-xr-x 1 root wheel 1 Sep 27 12:47 Current -> A
lrwxr-xr-x 1 root wheel 3 Sep 27 13:10 CurrentJDK -> 1.6

Then I downloaded and extracted VisualVM and ran it with the following command.

polar:bin dhruba$ pwd
polar:bin dhruba$ ./visualvm --jdkhome /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/

Leopard VisualVM
Leopard VisualVM

Et voila. VisualVM is a great tool. It can do all the things that one previously did on the command line such as creating and analysing dumps. It can do everything that jconsole previously did once the mbeans plugin has been auto-installed on visualvm. And the icing on the cake is that it can do lightweight and local profiling of any java application through on-demand on-the-fly bytecode instrumentation.

The downside is that it does not support remote profiling like other professional profilers such as JProfiler. If you’re developing locally it doesn’t matter anyway. You can profile locally and save yourself the license cost. However sometimes you must run your application remotely however and for those occasions something like JProfiler is indispensable.

If there’s further demand I’ll do a more more detailed run through the feature set of visualvm. However as Matthew McCullough points out there are plenty of resources on that already.

Note: For the record I do Java development on Linux as my first choice and on Mac when Linux isn’t available such as when I’m on the move although I do have Linux in Parallels on my Mac just in case I need it. It’s hard to beat native Sun support for the HotSpot VM on Linux and also Linux as a development environment in general.

Leave a Reply