Building OpenJDK and OpenJFX on Windows (Mid August 2018)
A lot has changed in the last year when it comes to building OpenJDK and OpenJFX on Windows (10 64bits) (single repository, integrated Freetype, VS2017)… and some more changes are expected with project Skara.
In the mean time here are some updated steps:
Update: 2018-08-18: VS2017 15.8 broke the OpenJFX build, updated the steps with an additional one to work around this issue.
Create a C:\dev\ directory
Download and install 7-zip (if needed, to open .tar.gz and .xz files)
Download and install
Download OpenJDK 10 and extract it to C:\dev\jdk-10.0.2
Dowload Apache Ant (1.10.5) and extract it to C:\dev\apache-ant-1.10.5 (for OpenJFX)
Download and install Cygwin
select the following packagesautoconf
make
zip
unzip
Download and install Visual Studio 2017 Build Tools (when installing select the Visual C++ Build Tools, and ensure the language module is English (only))
(To fix the OpenJFX build with VS2017 15.8) Open C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include\xhash in a notepad then locate
// FUNCTION TEMPLATE hash_value
and add the following line below it:
#define _HASH_SEED (size_t)0xdeadbeef
Get OpenJDK’s source:
in a (cmd) console:cd C:\dev
hg clone http://hg.openjdk.java.net/jdk/jdk/alternatively instead of attempting to clone from hg.openjdk.java.net (especially from Europe), download and extract Alexsey Shipilev’s https://builds.shipilev.net/workspaces/jdk-jdk.tar.xz then extract in C:\dev\jdk then
cd C:\dev
hg pull
hg updateGet OpenJFX’s source:
in a (cmd) console:cd C:\dev
hg clone http://hg.openjdk.java.net/openjfx/jfx/rt/ jfxalternatively instead of attempting to clone from hg.openjdk.java.net (especially from Europe), there is a git mirror of the http://hg.openjdk.java.net/openjfx/jfx-dev/rt/ at https://github.com/javafxports/openjdk-jfx (install Git for Windows then)
cd C:\dev
git clone https://github.com/javafxports/openjdk-jfx jfxBuild OpenJDK
in a Cygwin console:cd /cygdrive/c/dev/jdk
bash configure –with-boot-jdk=/cygdrive/c/dev/jdk-10.0.2/ –disable-warnings-as-errors
make images(–disable-warnings-as-errors so that VS2017 warnings are not stopping the build)
Build OpenJFX
in a (cmd) console:cd C:\dev\jfx
set _JAVA_OPTIONS=-Dorg.gradle.daemon=false -Dsun.reflect.debugModuleAccessChecks=true
set ANT_HOME=C:\dev\apache-ant-1.10.5
set JAVA_HOME=C:\dev\jdk-10.0.2
set VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
set MSVC_VER=14.14.26428
set PATH=%PATH%;%JAVA_HOME%\bin;%GRADLE_HOME%\bin;%ANT_HOME%\bin
gradlew jmods(where 14.14.26428 is the name of the directory C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428)
Create a combined image
in a (cmd) console:cd C:\dev
C:\dev\jdk\build\windows-x86_64-normal-server-release\images\jdk\bin\jlink –output openjdk-openjfx-image –module-path C:\dev\jdk\build\windows-x86_64-normal-server-release\images\jdk\jmods;C:\dev\jfx\build\jmods –add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,java.security.jgss,java.security.sasl,java.smartcardio,java.sql,java.sql.rowset,java.transaction.xa,java.xml,java.xml.crypto,jdk.accessibility,jdk.aot,jdk.attach,jdk.charsets,jdk.compiler,jdk.crypto.cryptoki,jdk.crypto.ec,jdk.crypto.mscapi,jdk.dynalink,jdk.editpad,jdk.hotspot.agent,jdk.httpserver,jdk.internal.ed,jdk.internal.jvmstat,jdk.internal.le,jdk.internal.opt,jdk.internal.vm.ci,jdk.internal.vm.compiler,jdk.internal.vm.compiler.management,jdk.jartool,jdk.javadoc,jdk.jcmd,jdk.jconsole,jdk.jdeps,jdk.jdi,jdk.jdwp.agent,jdk.jfr,jdk.jlink,jdk.jshell,jdk.jsobject,jdk.jstatd,jdk.localedata,jdk.management,jdk.management.agent,jdk.management.jfr,jdk.naming.dns,jdk.naming.rmi,jdk.net,jdk.pack,jdk.rmic,jdk.scripting.nashorn,jdk.scripting.nashorn.shell,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsupported,jdk.xml.dom,jdk.zipfs,javafx.graphics,javafx.swing,javafx.web,javafx.media,javafx.fxmlTest it
in a (cmd) console:cd C:\dev
openjdk-openjfx-image\bin\java –versionthen in the same console:
set _JAVA_OPTIONS=-Dorg.gradle.daemon=false -Dsun.reflect.debugModuleAccessChecks=true
set ANT_HOME=C:\dev\apache-ant-1.10.5
set JAVA_HOME=C:\dev\jdk-10.0.2
set VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
set MSVC_VER=14.14.26428
set PATH=%PATH%;%JAVA_HOME%\bin;%GRADLE_HOME%\bin;%ANT_HOME%\bin
gradlew apps
openjdk-openjfx-image\bin\java -jar jfx\apps\samples\Ensemble8\dist\Ensemble8.jarhack!
Caveat: these steps don’t build optionals nor do they run the tests. For further information check the JDK build doc and the JFX build doc.