Update 26/5/9: Updated for last night’s source with the JIBX libraries, and note on the version of XCode.
So, I’ve just got my laptop back after a brief separation. What does one do?
Compile the JDK, of course!
For those unfamiliar with the situation, Apple hate Java developers. Well, one suspects they do. Apple being Apple, one never knows. We could get Java 1.6.0_12 with 32bit support tomorrow, or it could never come. You’ll never know until it appears.
Luckily, Landon Fuller loves us. Which Apple play with their iPhones, he beat the OpenJDK into submission on OS X. Only drawback – Swing is X11 based. But still, it’s JDK6 for 10.4, 10.5 and in both 32 and 64bit, and available as SoyLatte.
This work has all found its way back into the trunk, and so JDK7 is buildable on the Mac (usually). The only catch: the instructions are scattered, and often vary slightly. So I’m documenting them here for tonight’s build, mostly for my reference.
Thanks go to Landon Fuller and Stephen Bannasch for putting these together.
1. Get version 3.1 (or above, presumably) of XCode.
2. Download SoyLatte. I found the JDK7 build Landon released in 2008 did not work as a bootstrap.
3. Get Mercurial
sudo port install mercurial +bash_completion
4. Install the Forest extension
hg clone http://bitbucket.org/pmezard/hgforest-crew
You’ll need to point Mercurial at the hgforest-crew directory, by adding the following to ~/.hgrc:
[extensions] hgext.forest=/opt/hgforest-crew/forest.py
5. Grab Kurt Miller’s BSD binary plugs:
wget http://www.intricatesoftware.com/distfiles/jdk-7-icedtea-plugs-1.6b.tar.gz
6. Get the JIBX libraries (version 1.1.5) from:
http://sourceforge.net/project/showfiles.php?group_id=69358&package_id=68290
7. Check out the OpenJDK:
hg fclone http://hg.openjdk.java.net/bsd-port/bsd-port
8. Place the following in build.sh in the bsd-port directory (modify as appropriate, depending on where you placed downloaded items):
LC_ALL=C LANG=C unset CLASSPATH unset JAVA_HOME make \ ALT_BOOTDIR=/opt/soylatte16-i386-1.0.3/ \ ALT_BINARY_PLUGS_PATH=/opt/jdk-7-icedtea-plugs \ ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \ ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \ ALT_JIBX_LIBS_PATH=/opt/jibx/lib \ ALT_CUPS_HEADERS_PATH=/usr/include \ ANT_HOME=/usr/share/ant \ NO_DOCS=true \ HOTSPOT_BUILD_JOBS=2
9. Run, and cross your fingers!
10. I ran into a ld error (archive has no table of contents). Should you hit this, try the following and then rerun build.sh:
ranlib build/bsd-i586/tmp/java/fdlibm/obj/*.a
11. Copy bsd-port/build/bsd-i586/j2sdk-image somewhere useful – and you’re done!








by Lakshmi Narasu Chenduri
25 Feb 2009 at 03:36
This is a class java build. We can get the sources from the Sun network and we can compile…. They even have given instructions.
by marcuso
25 Feb 2009 at 14:47
… and the Mac is so unserfriendly.
Honestly: a pain in the a*** and me as a Java developer having decided to buy a Mac because I wanted to escape such build orgies is really annoyed having to run Windows in a virtual machine when hacking on the latest Java technology.
Kicking in open doors, I know …
Anyway, thanks for providing yet another do-it-yourself how-to!
Marcus
by Sakuraba
26 Feb 2009 at 18:48
Nice tutorial, thank you!
by karthik
01 Apr 2009 at 23:39
The build fails when I set ALT_BOOTDIR to the 64 bit soylatte.
The linker is not able to find libjvm.dylib which sits in a different location in the 64 bit version.
I browsed around the makefile but I could not find a place where I could change the build process to build using the 64 bit libraries.
Any help would be greatly appreciated.
by James
07 Apr 2009 at 15:33
Sorry, no ideas here – I’ve had too many problems with 64bit Java to want to build it =/
by rue
11 Apr 2009 at 19:14
Need GCC 4.2+ to build, so it may be necessary to upgrade to a recent Xcode or just build your own from MacPorts (in which case CC and CXX must be set to the correct binaries as you hopefully gave them a program-suffix).
by Howard Lovatt
11 May 2009 at 08:32
Hi,
Are you making regular builds available?
Cheers,
Howard.
by Nicholas Riley
26 May 2009 at 06:22
Note that using Apple’s GCC 4.2 causes the built JVM to crash. Apple’s GCC 4.0.1 is fine, as may be a later GCC built from MacPorts (I haven’t tried it).
by James
26 May 2009 at 09:12
Howard – sorry, no plans to do builds. I’m inconsistent enough without more jobs to do :-)
Rue – thank you, indeed, if you’re going for the XCode route you will need the latest version.
Nicholas – thanks for that note.
by rich
10 Jul 2009 at 00:10
build fails with:
Leopard 10.5.7 and soylatte 1.6
current version of XCode as per Apple web site.
classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/UIPropertyMapper.java:44: org.jdesktop.synthdesigner.synthmodel.jibxhelpers.UIPropertyMapper is not abstract and does not override abstract method isExtension(java.lang.String) in org.jibx.runtime.IMarshaller
public class UIPropertyMapper implements IMarshaller, IUnmarshaller {
^
8 errors
make[4]: *** [/Users/alpha/bsd-port/build/bsd-i586/btclasses/org/jdesktop/synthdesigner/generator/Generator.class] Error 1
make[3]: *** [all] Error 1
make[2]: *** [all] Error 1
make[1]: *** [jdk-build] Error 2
make: *** [build_product_image] Error 2
by James
10 Jul 2009 at 13:33
I’d imagine the current build is broken, as it worked for me on the 7th of July.
Joys of grabbing from the trunk =)
by Dave Cheney
04 Oct 2009 at 07:24
@rich, you’re using the wrong version of jibx. I got the same problem with 1.2.1 which is the current from the website, try with 1.1.5 or 1.1.6a, or edit the source files to reflect the change in the interface.
by alwi Mansyur
11 Nov 2009 at 07:47
opo iki
by Shingo
22 Jun 2010 at 21:08
This page’s text-shadow is very cool!