Building Java 7 on Mac OS X
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. Download SoyLatte. I found the JDK7 build Landon released in 2008 did not work as a bootstrap.
2. Get Mercurial
sudo port install mercurial +bash_completion
3. 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:
4. Grab Kurt Miller’s BSD binary plugs:
5. Check out the OpenJDK:
hg fclone http://hg.openjdk.java.net/bsd-port/bsd-port
6. Place the following in build.sh in the bsd-port directory:
7. Run, and cross your fingers!
8. I ran into a ld error (archive has no table of contents). Should you hit this, try:
9. Copy bsd-port/build/bsd-i586/j2sdk-image somewhere useful – and you’re done!
- New to Java – Getting started tutorial
- Creating programs – Java Tutorial
- Methods and classes – Java Tutorial
- Blocks and overloading – Java Tutorial
- Input, Selection and Repetition
- How to create arrays and strings – Java tutorial
- Advanced array techniques – Java tutorial
- Creating applets – Java Tutorial
- Inheritance and class extensions – Java Tutorial
- Super classes and subclasses – Java Tutorial
- Abstract Class – Java Tutorial
- Introduction to Exception Handlers – Java tutorial
- Input and Output – Java tutorial
- New to Java – Introductory guide for beginners
- Getting started with Java
- Building Java 7 on Mac OS X
- What and How of java
- Java Interview Questions
- Java Aspects
- Java Enums
- Java Generics
- Java Annotations
- Autoboxing in Java
- Ten things a Java developer should know
- Java 8 Overview
- Default Methods in Java 8
- Lambda Expressions in Java 8
- Parallel Operations in Java 8
- Date and Time API in Java 8
- Top 5 Java Books for beginners