Building a UI toolkit for many different platforms is a complex and challenging endeavor. It requires platform specific tools such as C compilers as well as portable tools like Gradle and the JDK. Which tools must be installed differs from platform to platform. While the OpenJFX build system was designed to remove as many build hurdles as possible, it is often necessary to build native code and have the requisite compilers and toolchains installed. On Mac and Linux this is fairly easy, but setting up Windows is more difficult.
If you are looking for instructions to build FX for JDK 8uNNN, they have been archived here.
Starting with Java 9, and the introduction of the module system, The FX modules are now an integral part of the runtime environment for the desktop. Because of this tie, there is currently no provision or capability for the output of the OpenJFX 9 or later build to be used as an overlay. It is still possible however to develop and enhance OpenJFX, and use that result to build an OpenJDK.
- Cmake 3.8.2 or later, available from the Cmake download site
- Additional cygwin tools:
You will likely need to set the following env variables to point to your VS 2017 installation, since Microsoft no longer sets such variables. This presumes that you are using build 14.11.25503 of the Community edition of Visual Studio 2017. You should adjust it as needed for your system.
export VS150COMNTOOLS="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build" export JAVA_HOME="C:/Program Files/Java/jdk-10" export MSVC_VER=14.11.25503
Note the use of the double backslash in the VS150COMNTOOLS env var. This is needed because the cygwin shell uses the '\' as an escape character. With JAVA_HOME it is easier to just set it using forward slashes (although backslashes are fine as long as you escape them).
You will need macOS 10.12 (Sierra) or later.
Install the latest version of Xcode (we use 9.1) and that you have the developer command line tools installed. You can install them by using the menus within Xcode: XCode -> Preferences -> Downloads -> Components.following software:
- Xcode 9.1 or later
- Xcode developer command line tools – you can install them by using the menus within Xcode: XCode -> Preferences -> Downloads -> Components
- mercurial (hg)
Setting up a Linux build configuration is fairly straightforward. These build instructions were used for Ubuntu 16.04.
First, run the following command to install all the required development packages:
TODO: verify and update this (I think many are unused)
sudo apt-get update sudo apt-get install ksh bison flex gperf libasound2-dev libgl1-mesa-dev \ libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libjpeg-dev \ libpng-dev libx11-dev libxml2-dev libxslt1-dev libxt-dev \ libxxf86vm-dev pkg-config x11proto-core-dev \ x11proto-xf86vidmode-dev libavcodec-dev mercurial \
libgtk2.0-dev libgtk-3-dev \ libxtst-dev libudev-dev libavformat-dev
- Cmake 3.8.2 or later, available from the Cmake download site
With Ubuntu 16, the The following should satisfy the requirements (but check the version of cmake) :
sudo apt-get install cmake rubybison flex gperf ruby
Oracle Enterprise Linux 7 and Fedora 21
We use Oracle Linux 7 to build the javafx.* modules that we ship with the Oracle JDK releases. Here are the packages you will need:
TODO: verify and update this
yum install mercurial bison flex gperf ksh pkgconfig \
libpng12-devel libjpeg-devel libxml2-devel \
libxslt-devel systemd-devel glib2-devel gtk2-devel \
libXtst-devel pango-devel freetype-devel
JDK 9.x or JDK 10 EA (build 35 or later)
Download and install the current early access from JDK9 Early Access Download. This version will be used for testing clients and for unit test runs. (And eventually for compilation). Current minimun is build 148 (check with java -version). Note that this version will change as we move closer to the release.JDK 9 or later to use as the boot JDK to build and test OpenJFX. We recommend either JDK 9.0.1 or a recent JDK 10 Early Access build.
OpenJFX, as with OpenJDK, uses Mercurial as the source control system. You must install some support for using Mercurial. Many (if not all) IDEs include built in support, although the tooling is generally not as good as you might get from a standalone tool.
You must also install Gradle. We are using Gradle is the primary build tool for building OpenJFX. We currently use Gradle 4.3 for jfx-dev (IMPORTANT: Only this version is regularly tested).
Note: gradle is available as a Ubuntu package, but check the version. This command should work after you set JAVA_HOME:
You will need Apache Ant 1.8.2 to build the OpenJFX apps (IMPORTANT: there are known issues with later versions of ant, so get exactly version 1.8.2).
At a minimum, you will need to have gradle in your path:
- set JAVA_HOME and JDK_HOME to point to the root of your jdk-9 or jdk-10 -ea EA release.set gradle
- add $JAVA_HOME/bin to your PATH
- add gradle-4.3+ in your pathset ant /bin to your PATH
- add apache-ant-1.8.2 in /bin to your pathPATH
Note: on windows, these paths MUST the JAVA_HOME and JDK_HOME variables must be in dos DOS format , though (e.g., "C:/Program Files/..." rather than "/cygdrive/c/Program Files/..."), although you can use forward slashes ('/'). Test your settings with:
"$JAVA_HOME/bin/java" -version gradle -version ant -version
IMPORTANT: Any time you change env settings or install new software after a failed build of JavaFX you should execute the following three commands:
gradle --stop rm -rf build gradle clean
The first is needed to stop any gradle daemons that might be running (by default gradle starts a daemon that is used to speed up subsequent builds). There is a bug in the gradle daemon that causes gradle to ignore any env variables set after the daemon is started (see JDK-8193288). Additionally, on Windows platforms, the gradle daemon can sometimes interfere with your ability to delete files that it keeps open. If you run into problems you can stop the gradle daemon with "gradle --stop" (or disable the gradle daemon altogether).
The second is needed because the OpenJFX build caches the results of a previous configuration, in such a way that it can cause gradle clean to fail.
Getting the Sources
All OpenJFX sources are held in mercurial repositories. As mentioned in Repositories and Releases, we have several different repositories for you to choose from, although most developers should use the mainline jfx-def repo.
# for the active development stream, currently targeted for JDK 11 hg clone http://hg.openjdk.java.net/openjfx/jfx-dev/rt