Building OpenJDK and OpenJFX on Windows (September 2020)
The JDK has just moved to GitHub through project Skara. I am moving to a new laptop. So it is time to revisit building OpenJDK and OpenJFX (on Windows 10 64bits).
Create a C:\dev\ directory
Download and install Cygwin
select the following packagesautoconf
make
zip
unzip
Download and install Git
Either from Git for Windows or via Cygwin (the later may be more compatible with the build)
Download the current OpenJDK and extract it to C:\dev\jdk-14.0.2
Download and install Visual Studio 2019 Build Tools (when installing select the Visual C++ Build Tools, and ensure the language module is English (only))
On my system (Windows 10 2004), the short names for some of the directories needed are not created, these can be created using (in an elevated console):
fsutil file setshortname “C:\Program Files (x86)\Microsoft Visual Studio” MSVSTU~1
fsutil file setshortname “C:\Program Files (x86)\Windows Kits” WINKIT~1
Dowload Apache Ant (1.10.6) and extract it to C:\dev\apache-ant-1.10.6 (for testing OpenJFX)
Get OpenJDK’s source:
in a console:cd C:\dev
git clone https://github.com/openjdk/jfx/If using Git for Windows ensure the line endings setting is set to check out with unix line endings.
If using cygwin’s git, use cygwin’s consoleGet OpenJFX’s source:
in a console:cd C:\dev
git clone https://github.com/openjdk/jfx/Build OpenJDK
in a Cygwin console:cd /cygdrive/c/dev/jdk
bash configure –with-boot-jdk=/cygdrive/c/dev/jdk-14.0.2/ –disable-warnings-as-errors
make images(–disable-warnings-as-errors so that VS2019 warnings are not stopping the build)
(a configure line with more details: bash configure –with-boot-jdk=/cygdrive/c/softs/openjdk14.0.2-image/ –disable-warnings-as-errors –with-vendor-name=LH –with-vendor-url=https://lhochet.dev –with-version-build=15)
Build OpenJFX
in a (cmd) console:cd C:\dev\jfx
set _JAVA_OPTIONS=-Dorg.gradle.daemon=false -Dsun.reflect.debugModuleAccessChecks=true
set JAVA_HOME=C:\dev\jdk-14.0.2
set VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build
set MSVC_VER=14.27.29110
set PATH=%PATH%;%JAVA_HOME%\bin
gradlew jmods(where 14.27.29110 is the name of the directory C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110)
Create a combined image
in a (cmd) console:cd C:\dev
C:\dev\jdk\build\windows-x86_64-server-release\images\jdk\bin\jlink –output openjdk-openjfx-image –module-path C:\dev\jdk\build\windows-x86_64-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.incubator.jpackage,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.nio.mapmode,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsupported,jdk.unsupported.desktop,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 –version
then in the same console:
cd jfx set _JAVA_OPTIONS=-Dorg.gradle.daemon=false -Dsun.reflect.debugModuleAccessChecks=true
set ANT_HOME=C:\dev\apache-ant-1.10.6
set JAVA_HOME=C:\dev\jdk-14.0.2
set VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build
set MSVC_VER=14.27.29110
set PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin
gradlew apps
cd .. 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.