Saturday 19 July 2014

Building OpenJFX on Windows

This post is a step by step to build OpenJFX on Windows (8.1 64bits). It is inspired from the official instructions though it drops Visual Studio Express (which does not come with 64bits compiler and linker) in favour of plain SDK. It also uses Babun rather than plain Cygwin.

  1. Create a C:\dev directory
  2. Download and install a Java 8 JDK (I'm using 8u20 here)
  3. Download Gradle 1.8 and extract it into C:\dev
  4. Download and install Windows SDK 7.1 (no need for the samples or .Net tools)
  5. The SDK installer has a small issue in that it doesn't create a registry key that is needed by the batch files that set up the environment variables...
    Copy and paste the following into a vs.reg file:
    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7]
    "10.0"="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\"
    once saved, double click on the file to add the registry key.
  6. Download and install Microsoft DirectX 9.0 SDK (from June 2010)
  7. Download Babun, unpack into a temporary directory, open a console in the babun directory and type:
    install /target C:\dev
  8. Download and install Mercurial
  9. In C:\dev open a standard console
  10. Get the sources:
    In the console copy:
    hg clone http://hg.openjdk.java.net/openjfx/8u-dev/rt jfx
  11. Set up some environment variables:
    Still in the console:
    set GRADLE_HOME=C:\dev\gradle-1.8
    set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_20
    set PATH=%PATH%;%JAVA_HOME%\bin;%GRADLE_HOME%\bin;C:\dev\.babun\cygwin\bin
    set WINSDK_DIR=C:\Program Files\Microsoft SDKs\Windows\v7.1
    (The later indicating to use the Windows 7.1 SDK for includes and libs)

  12. Build:
    Still in the console:
    cd jfx
    gradle
  13. Open an admin console (search for cmd then right click then run as admin), then run the following to update the JavaFX files in the JDK:

    copy C:\dev\jfx\build\sdk\bin\*.* "C:\Program Files\Java\jdk1.8.0_20\bin"
    copy C:\dev\jfx\build\sdk\lib\*.* "C:\Program Files\Java\jdk1.8.0_20\lib"

    copy C:\dev\jfx\build\sdk\rt\bin\*.* "C:\Program Files\Java\jdk1.8.0_20\jre\bin"
    copy C:\dev\jfx\build\sdk\rt\lib\*.* "C:\Program Files\Java\jdk1.8.0_20\jre\lib"
    copy C:\dev\jfx\build\sdk\rt\lib\ext\*.* "C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext"
  14. In the console that built OpenJFX:
    gradle sampleAppsJar -Dplatforms.JDK_1.8.home="%JAVA_HOME%"
    then
    "%JAVA_HOME%\bin\java" -jar C:\dev\jfx\apps\samples\Ensemble8\dist\Ensemble8.jar
  15. Hack...

Using Babun seems to take care of the Cygwin packages that are needed by OpenJFX, those that may not be already installed may be added using:
pact install  <package name>
(an exception being g++: mingw64-x86_64-gcc-g++ )

No comments: