Just An Application

September 27, 2012

Building The Project Lambda JDK From Source On Mac OS X Snow Leopard

As I mentioned in my previous post I first tried to build the Project Lambda JDK from source on Snow Leopard using the Mac OS X OpenJDK port of JDK 7 and the build failed with a slew of compilation errors.

On this occasion I will spare you the gory details but it looks as though the Mac OS X OpenJDK port version of JDK 7 is out of date, so is there a more up to date version of JDK 7 that can be built from source on Snow Leopard ?

The answer is yes the OpenJDK JDK 7 Update project (JDK7u) version.

1.0 Building JDK7u From Source

1.1 Getting The Source

The JDK7u Mercurial repository can be cloned using the command

    hg clone http://hg.openjdk.java.net/jdk7u/jdk7u jdk7u

Once you have done this you need to clone the nested Mercurial repositories which comprise the JDK itself by changing to the directory containing the JDK7u repository and running the command

    sh ./get_source.sh

1.2 Building

To build the JDK7u version of the JDK you need to run the command

    make \
        LANG=C \
        ALT_BOOTDIR=/Library/Java/JavaVirtualMachines/1.6.0_31-b04-413.jdk/Contents/Home

in the root directory of the JDK7u repository

The ALT_BOOTDIR argument identifies the location of the home directory of the installed version of JDK 6 for Snow Leopard.

Note that although the documentation in README-builds.html requires that you install XCode 4.1 or higher fwiw I built it sucessfully with Xcode 3.2.4 installed.

The built JDK ends up in the directory

    build/macosx-x86_64/j2sdk-image

2.0 Building The Project Lambda JDK

You can build the Project Lambda JDK in exactly the same way as on Lion.

Change to the common/makefiles directory

    cd common/makefiles

Do the configuration

    ../autoconf/configure --with-boot-jdk=<elided>/jdk7u/build/macosx-x86_64/j2sdk-image

The --with-boot-jdk argument identifies the location of the built JDK7u JDK

Then do the build

    make images

As on Lion the resulting JDK will be in the directory

    build/macosx-x64-normal-server-release/images/j2sdk-image

Copyright (c) 2012 By Simon Lewis. All Rights Reserved.

Blog at WordPress.com.

%d bloggers like this: