Thursday, 14 May 2015

Building Java 9 on Windows with Visual Studio 2013 Community

As the JDK moves to Visual Studio 2013 for its toolchain, this version focuses on building Java 9 on Windows (10 64bits) with Visual Studio 2013 (Community). As it takes a few short-cuts, refer to the Java 9 with plain Windows SDK version or/and to the Java 8 version (for using plain Cygwin).

  1. Create a C:\dev\ directory
  2. Download and install Visual Studio 2013 Community
    1. Download (it may be faster to download the ISO)
    2. Install
      • uncheck all the options
      • or download AdminDeployment.xml to C:\dev\temp then start the installation with:
        vs_community.exe /AdminFile C:\dev\temp\AdminDeployment.xml
    3. Add the path to MSBuild to the PATH environement variable (required to build Freetype):
      C:\Program Files (x86)\MSBuild\12.0\Bin
  3. Download and install the Mercurial for Windows 
  4. Download and install Java 8 (if not already done)
  5. Download and install Babun, then use its package manager to install zip :
    pact install zip
  6. Download Freetype source (2.5.5) and extract to C:\dev\freetype-2.5.5
  7. In the Babun console:
    cd /cygdrive/c/dev
  8. Get the root source:
    hg clone http://hg.openjdk.java.net/jdk9/jdk9/
     (or the more bleeding edge http://hg.openjdk.java.net/jdk9/dev/ )
  9. Move to the new directory
    cd /cygdrive/c/dev/jdk9
  10. Get the remainder of the source
    ./get_source.sh 
  11. Force the permissions
    chmod -R u+rwxs .
    (otherwise some files get access denied errors)
  12. Run the auto-conf script
    bash configure --with-freetype-src=/cygdrive/c/dev/freetype-2.5.5
  13. Time for cooking
    make images
  14. Once done, open a new standard Windows console and navigate to
    C:\dev\jdk9\build\windows-x86_64-normal-server-release\images\jdk
    check that java runs:
    bin\java -version
    or for something a bit more visual:
    bin\jconsole
  15. enjoy!
For day to day refresh do the following (in the Babun shell):
  1. Go to the JDK directory
    cd /cygdrive/c/dev/jdk9
  2. Get the sources updates
    ./get_source.sh
  3. Force the permissions
    chmod -R u+rwxs .
  4. Remove the build directory
    rm -rf build/
  5. Rerun the auto-conf script to update the time stamp of the build:
    bash configure --with-freetype-src=/cygdrive/c/dev/freetype-2.5.5
  6. Re-heat
    make images

No comments: