Keep your Java environment up-to-date on Mac OS X 10.4 with SoyLatte

Filed under

I recently needed Java 6 to install an Eclipse patch. As you're probably aware, although Apple updated OS X 10.5 Leopard to Java 6 they probably never will provide updates beyond Java 5 for Mac OS X 10.4 Tiger. The good news is that if you're running an Intel-based Mac, you can keep your Java environment up-to-date with SoyLatte, which is part of the OpenJDK BSD-Port project.

From the SoyLatte project site:

SoyLatte is a functional, X11-based port of the FreeBSD Java 1.6 patchset to Mac OS X Intel machines. SoyLatte is initially focused on supporting Java 6 development; however, the long-term view far more captivating: open development of Java 7 for Mac OS X, with a release available in concert with the official Sun release, supported on all recent versions of Mac OS X.

If you check your current Java version from a terminal, you'll likely see version 1.5.

% java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-275)
Java HotSpot(TM) Client VM (build 1.5.0_16-132, mixed mode, sharing)

The installation of SoyLatte is simple:

  1. Download the SoyLatte 32-bit JDK binary for OS X 10.4 to your Desktop. Use the username and password provided at the beginning of the Download section, just above the binary download link.
  2. Store and unpack the binary anywhere. I put mine in /usr/local and created a version agnostic symbolic link which I'll update after future SoyLatte updates.
    % sudo bunzip2 ~/Desktop/soylatte16-i386-1.0.3.tar.bz2
    % sudo tar xvf ~/Desktop/soylatte16-i386-1.0.3.tar -C /usr/local
    % sudo ln -s /usr/local/soylatte16-i386-1.0.3 /usr/local/soylatte16-i386 % ls -l /usr/local
    lrwxr-xr-x 1 root wheel 21 Dec 22 14:25 soylatte16-i386 -> soylatte16-i386-1.0.3
    drwxr-xr-x 16 root wheel 544 Dec 22 14:23 soylatte16-i386-1.0.3 
  3. Add SoyLatte to your path. Mine's defined in ~/.profile, your's might be in ~/.bash_profile.
    export PATH
  4. Save and reload your profile % source ~/.profile
  5. Check your Java version, you should now see 1.6.
    % java -version
    java version "1.6.0_03-p3"
    Java(TM) SE Runtime Environment (build 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00)
    Java HotSpot(TM) Client VM (build 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00, mixed mode)

You should now be able to run Java 6 applications. I noticed that when running terminal in X11 that Java still shows as 1.5 until I source my .profile from X11. If you use X11's terminal you'll either need to remember to do this or figure out how to have your profile loaded there.