Sunday 10 April 2016

Building OpenJDK 9 with OpenJFX 9 on Windows, the Jigsaw way

This post is a step by step to build the OpenJDK 9 with OpenJFX 9 with the Jigsaw changes on Windows (10 64bits).
It is based on the Jake instructions.

Update: 2017-01-21: OpenJFX has updated build requirements

  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 (for OpenJDK)
  5. Download and install JDK 9 b150+ (for OpenJFX)
  6. Download and install Babun, then use its package manager to install zip :
    pact install zip
  7. Download Freetype source (2.6.2) and extract to C:\dev\freetype-2.6.2
  8. Download Gradle 3.1 (for OpenJFX) and extract it into C:\dev
  9. Download Ant 1.8.2 (for OpenJFX) and extract it into C:\dev

     
  10. Get the JDK's source
    In the Babun console:
    cd /cygdrive/c/dev
    hg clone http://hg.openjdk.java.net/jdk9/jdk9/
    cd /cygdrive/c/dev/jdk9
    ./get_source.sh
  11. Get OpenJFX' source
    In the Babun console:
    cd /cygdrive/c/dev
    hg clone http://hg.openjdk.java.net/openjfx/9/rt/ jfx9


  12. Build OpenJFX
    In the 'DOS' console:
    cd C:\dev\jfx9
    set GRADLE_HOME=C:\dev\gradle-3.1
    set ANT_HOME=C:\dev\apache-ant-1.8.2
    set JAVA_HOME=C:\Program Files\Java\jdk-9
    set PATH=%PATH%;%JAVA_HOME%\bin;%GRADLE_HOME%\bin;%ANT_HOME%/bin;%USERPROFILE%\.babun\cygwin\bin
    set _JAVA_OPTIONS=-Dsun.reflect.debugModuleAccessChecks=true --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED


    gradle
  13. Run the auto-conf script for OpenJDK
    In the Babun console:
    cd /cygdrive/c/dev/jdk9
    bash configure --with-freetype-src=/cygdrive/c/dev/freetype-2.6.2 --with-import-modules=/cygdrive/c/dev/jfx9/build/modular-sdk
  14. Time for cooking
    make images
    
    
    
  15. Once done, open a new 'DOS' console and navigate to
    cd 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
  16.  To check JavaFX,
    in the 'DOS' console compile the sample apps:
    cd C:\dev\jfx9
    set GRADLE_HOME=C:\dev\gradle-3.1
    set ANT_HOME=C:\dev\apache-ant-1.8.2
    set JAVA_HOME=C:\Program Files\Java\jdk-9
    set PATH=%PATH%;%JAVA_HOME%\bin;%GRADLE_HOME%\bin;%ANT_HOME%/bin;%USERPROFILE%\.babun\cygwin\bin
    set _JAVA_OPTIONS=-Dsun.reflect.debugModuleAccessChecks=true --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED


    set JIGSAW_HOME=C:\dev\jdk9\build\windows-x86_64-normal-server-release\images\jdk
    gradle apps

    then launch:
    %JIGSAW_HOME%\bin\java -jar C:\dev\jfx9\apps\samples\Ensemble8\dist\Ensemble8.jar
  17. hack!