Building the JDK 6.0 on Windows XP

Building the JDK 6.0 on Windows XP

Just thought I would take some notes on setting up my Windows XP laptop at home to build the JDK 6.0 (specifically Build 51 or greater) and actually doing a build. My rough time estimates below are not very accurate, I wasn't actually sitting in from of this machine while it did all this, I was working on another machine getting some real work done. :\^) I'm using a ComCast cable modem setup at home, so my download speed is relatively fast. More details on all of this can be found at:

First the one time JDK 6.0 build machine setup:

  • Update Windows XP and reboot, validate, update and reboot, repeat until it's happy. :\^)
    And of course you should have up-to-date virus software and firewall software, etc.
  • Install the Visual Studio .NET 2003 Professional compilers and tools, doesn't matter much where, the makefiles should find it via the environment variables. Product information is here. This takes some time, allow an hour or so, maybe more. The reading from the CD's seemed really slow (humm I wonder if my virus software is slowing this down... oh well...).
  • Download DirectX 9 from and install it, doesn't matter much where, the makefiles should find it via the environment variables. This is a fairly big download and install, may take 30 minutes at the most, also requires a registration process that will happen at download or when you do the next Windows update, not sure when this will happen.
  • Download the Microsoft Layer for Unicode (MSLU) Platform Software Development Kit Redistributable from and install it at C:/MSLU if possible. This is a quick download and install, less than 10 minutes, you may have to search for it a bit. This is just the DLL file, and isn't really needed with XP as I understand it, the LIB file comes with the compiler install and will be found automatically. If you don't install it at C:/MSLU, make sure you put a 'cygpath -a -s -m' pathname in the ALT_UNICOWS_DLL_PATH variable in the profile.ksh file below.
  • Go to and download the latest cygwin. I downloaded everything to my C:/downloads/cygwin directory first, then installed from the local directory. This can take several hours maybe more depending on your download speed, even with a fast connection. After downloading, you might want to burn the download files to a CD for later use, or sharing with others. Alternatively you can install MKS 6.1 or greater, and also find a MKS built gnumake and zip/unzip, but I won't go down that path here. (Note MKS 8.7 has a dosname utility like cygpath, but the older MKS releases do not, so you will have to set many more ALT\* variables if you are using an older MKS, and make doubly sure they don't contain spaces and have the \\ replaced with /).
  • Time for a Windows XP Update and reboot cycle.
  • Download latest JDK 1.5 from and install it at C:/jdk1.5.0 if at all possible, and it's up to you if you also install Netbeans 4.1, now's your change to try it, there is a bundle that include both JDK 1.5 and Netbeans 4.1. This one instance of JDK1.5.0 should be all you need for all Mustang builds. If you don't install it at C:/jdk1.5.0, make sure you put a 'cygpath -a -s -m' pathname in the ALT_BOOTDIR environment variable in profile.ksh below.
  • Make sure the directory C:/temp exists for temp files during builds.
  • Make a mustang area by creating a C:/mustang directory.

Then the setup items specific to building JDK 6.0 Build 51 (you would repeat this for each build):

  • Make a C:/mustang/b51 directory to hold all this stuff.
  • Make a C:/mustang/mozilla directory. Download the Mozilla Binaries for Source Build 6.0 (Windows) jar bundle (small download) from into the C:/mustang/mozilla directory. Expand this file into that directory by running 'java -jar' on it: 'java -jar jdk\*.jar'. These mozilla files will likely not change between builds much, so you could probably do this once and forget it, notice I didn't put this in the b51 directory. Also, they are only needed to build the plugin, so everyone might not need them, but it's a quick and painless download and install.
  • Download the JDK 6.0 binary snapshot build from and place the file into C:/mustang/b51. Run this download file and have it install into C:/mustang/b51/jdk1.6.0. This is the pre-built Build 51 jdk1.6.0 directory containing a bin/java.exe file and an entire built jdk. If you plan on building the entire JDK from scratch, you actually don't need this, but it's nice to have in general, and in case you wish to skip the build of hotspot, or other components.
  • Download the two download bundles for the JDK 6.0 Source and JDK Binaries for Source Build 6.0 (font files, a small download) jar files from: and place these files inside C:/mustang/b51. Expand these files into C:/mustang/b51 by running each with: 'java -jar jdk\*.jar'. Make sure they both expand into the same top-level directory so that they overlay each other. You should see 6 directories when this is done: control, hotspot, j2se, motif, deploy, and install.

Ok, we should have everything we need. Now the shell profile and script setup. I created a small shell profile file called profile.ksh:

    # Mustang build profile and setup for this machine
    # The cygpath -a -s -m gives me an absolute, short, mixed (C:/ style) pathname
    bdir=`cygpath -a -s -m "${mustang}/${buildno}"`
    export USER=ohair
    export USERNAME=ohair   # Because of bug, I have a ' character in my name :\^(
    # Environment variables specific to JDK builds
    export ALT_BOOTDIR=C:/1.5.0
    export ALT_SLASH_JAVA=${bdir}
    export ALT_DEVTOOLS_DIR=`cygpath -a -s -m /usr/bin`
    export ALT_JDK_IMPORT_PATH=${bdir}/jdk1.6.0
    # Get these generic shell settings (or set your own LIB, INCLUDE, PATH, etc.)
    . ${bdir}/j2se/src/share/doc/build/jdk_generic_profile.ksh
    # Set your own shell prompt
    export PS1="MUSTANG-${buildno}[\\!] "
    # Let you know what ALT variables are set
    env | egrep '\^ALT\*'
    echo "Ready to build ${bdir}"

Then the build script could look something like:

    # Run this when inside C:/mustang/bNN
    # Setup environment
    . ${bdir}/profile.ksh
    # Cleanup if this is a repeat
    rm ${bdir}/build.log
    rm -f -r ${bdir}/control/build
    # Build, sending output to log file
    (cd ${bdir}/control/make && make dev > ${bdir}/build.log 2>&1 )
    # Wait a few hours, maybe longer, have a few cups of coffee, maybe a gallon or two. :\^)
    tail -20 build.log

Now wasn't that simple? The resulting build should be in C:/mustang/b51/control/build/windows-i586/j2sdk-image.

If anyone out there manages to try this, please let me know how it goes. I did all this outside the Sun internal network, so potentially anyone could do this, as long as they have accepted the various licenses they encountered along the way. Only the Microsoft compilers cost money, and they do have a free set of compilers, we just could not get them to work due to some missing components (outside the compilers themselves).

Post any questions or comments you have at:


Post a Comment:
Comments are closed for this entry.

Various blogs on JDK development procedures, including building, build infrastructure, testing, and source maintenance.


« July 2016