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.
For a ready made build, you can download it from the JDK 9, download page (or you can grab a JDK 10 early access build), or try the Community Build page or the JDK9 early access.
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:
- bison
- flex
- g++
- gperf
- perl
- python
- ruby
...
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.
- 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)
If you build WebKit (it is not built by default) you will need the following additional tools:
- Cmake 3.8.2 or later, available from the Cmake download site
- gperf
...
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.
Code Block |
---|
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).
Mac
You will need macOS 10.12 (Sierra) or later.
Install the 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)
If you build WebKit (it is not built by default) you will need the following additional tools:
- Cmake 3.
...
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:
Ubuntu 16.04
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
If you build WebKit (it is not built by default) you will need the following additional tools:
- Cmake 3.8.2 or later, available from the Cmake download site
- gperf
- ruby
Anchor | ||||
---|---|---|---|---|
|
Setting up a Linux build configuration is fairly straightforward. These build instructions were used for Ubuntu 16.04.
Ubuntu 16.04
First, run the following command to install all the required development packages:
With Ubuntu 16, the following should satisfy the requirements:TODO: verify and update this (I think many are unused)
sudo apt-get install cmake ruby gperf
Oracle Enterprise Linux 7 and Fedora 21
yumupdate sudo apt-get install mercurialksh bison flex gperf ksh pkgconfig \
libpng12-devel libjpeg-devel libxml2-devel \
libasound2-dev libgl1-mesa-dev \ libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libjpeg-dev \ libxsltlibpng-develdev systemdlibx11-develdev glib2libxml2-devel dev gtk2-devellibxslt1-dev libxt-dev \ libxxf86vm-dev pkg-config x11proto-core-dev \ x11proto-xf86vidmode-dev libavcodec-dev mercurial \
libXtst-devel pango-devel freetype-devel
Common Prerequisites
Java SE 9 for JDK 9
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.
Mercurial
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.
For Linux, the Mercurial package is included in the list of required packaged that were installed.
Popular options include SourceTree from Atlassian, TortoiseHg for Windows, or the command line tools from Mercurial.
Gradle
You must also install Gradle. We are using 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:
gradle -version
Environment Variables
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 release.
- set gradle 4.3+ in your path
- set ant 1.8.2 in your path
Note: on windows, these paths MUST be in dos format, though you can use forward slashes ('/'). Test your settings with:
Code Block |
---|
"$JAVA_HOME/bin/java" -version
gradle -version
ant -version |
libgtk2.0-dev libgtk-3-dev \
libxtst-dev libudev-dev libavformat-dev
If you build WebKit (it is not built by default) you will need the following additional tools:
- Cmake 3.8.2 or later, available from the Cmake download site
- bison
- flex
- gperf
- ruby
The following should satisfy the requirements (but check the version of cmake) :
sudo apt-get install cmake bison 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
Common Prerequisites
JDK 9.x or JDK 10 EA (build 35 or later)
Download and install 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.
Mercurial
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.
For Linux, the Mercurial package is included in the list of required packaged that were installed.
Popular options include SourceTree from Atlassian, TortoiseHg for Windows, or the command line tools from Mercurial. On Windows, you can also install Mercurial as a cygwin package.
Gradle
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:
gradle -version
Ant
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).
Environment Variables
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 release.
- add $JAVA_HOME/bin to your PATH
- add gradle-4.3/bin to your PATH
- add apache-ant-1.8.2/bin to your PATH
Note: on windows, the JAVA_HOME and JDK_HOME variables must be in DOS format (e.g., "C:/Program Files/..." rather than "/cygdrive/c/Program Files/..."), although you can use forward slashes ('/'). Test your settings with:
Code Block |
---|
"$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:
Code Block |
---|
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.
Code Block | ||
---|---|---|
| ||
# for the active development stream, currently targeted for JDK 11 hg clone http://hg.openjdk.java.net/openjfx/jfx-dev/rt |
...