Goals
- Pass all appropriate certification tests for Java SE 7
- Include a complete, native Cocoa-based UI Toolkit
- Provide excellent performance
Prerequisites
- Hardware: Any 64-bit capable Intel Mac
- RAM: 4GB, 2GB min
- OS: Mac OS X 10.6, run Software Update to get to at least 10.6.5
- Xcode: 3.2.5 or later from http://developer.apple.com (Mac Dev Center section)
- Java: "Java for Mac OS X 10.6 Update 3 Developer Package" or later from http://connect.apple.com (Java section)
- Mercurial: http://mercurial.berkwood.com/
- Jtreg: http://openjdk.java.net/jtreg/
Setup
Install the Mercurial "forest" extension:
cd /tmp hg clone http://bitbucket.org/pmezard/hgforest-crew/ cp hgforest-crew/forest.py ~/.forest.py
Add the following lines to your: ~/.hgrc
[extensions] hgext.forest=~/.forest.py
Source
hg fclone http://hg.openjdk.java.net/macosx-port/macosx-port cd macosx-port
Build
make CC=/Developer/usr/bin/llvm-gcc-4.2 CXX=/Developer/usr/bin/llvm-g++-4.2 ALLOW_DOWNLOADS=true SA_APPLE_BOOT_JAVA=true ALWAYS_PASS_TEST_GAMMA=true ALT_BOOTDIR=`/usr/libexec/java_home -v 1.6`
If you get errors warning about environmental variables that are set you can prefix the build command above unsetting these variables.
Example:
unset LC_ALL LANG CLASSPATH JAVA_HOME LD_LIBRARY_PATH; <command line to build JDK 1.7>
Smoke Test
$ build/macosx-universal/j2sdk-bundle/1.7.0.jdk/Contents/Home/bin/java -version
Install
mkdir -p ~/Library/Java/JavaVirtualMachines cp -R build/macosx-universal/j2sdk-bundle/1.7.0.jdk ~/Library/Java/JavaVirtualMachines
The "1.7.0.jdk" bundle can be copied or symlinked to ~/Library/Java/JavaVirtualMachines or /Library/Java/JavaVirtualMachines.
Once installed, the build will be discovered by /Applications/Utilities/Java Preferences.app, and found using the /usr/libexec/java_home tool, when passing it "--version 1.7".
By dragging the 1.7.0 version to the top of the Java Preferences lists, it will become the default JVM for command line use (since CommandLine is currently the only capability it supports).
Run
export JAVA_HOME=`/usr/libexec/java_home --version 1.7` $JAVA_HOME/bin/java -version
Test
jtreg is the test harness used by the OpenJDK test framework. The script linux/jtreg
is a shell script that runs fine on Mac OS X. It will run all the tests under $SRC/jdk/.
By default jtreg will use the current jvm for running both the test harness and the tests themselves.
The examples below use the jtreg option -jdk
to specify the JDK compiled in the macosx-port source directory.
Example: running all the jdk tests (takes a long time):
cd <path-to-macosx-port-source>/jdk/ <path to jtreg>/linux/bin/jtreg -jdk:../build/macosx-universal/j2sdk-bundle/1.7.0.jdk/Contents/Home/ -v:summary test
Example: running just the jdk java/lang tests (approximately 340 tests; completes in about 6 minutes):
cd <path-to-macosx-port-source>/jdk/ <path to jtreg>/linux/bin/jtreg -jdk:../build/macosx-universal/j2sdk-bundle/1.7.0.jdk/Contents/Home/ -v:summary test/java/lang
If you run jtreg
by making a symbolic link to linux/jtreg
in another directory already on your PATH
you will need to export a JT_HOME
environmental variable.
Caveats
If your version of Xcode is older than 3.2.5, the 32-bit build (java -d32 ...) won't start, but the 64-bit build will.
XToolkit currently does not function under 32-bit in universal builds.