OpenJDK and OpenJFX Installation Guide
PUBLISHED
Open Java Development Kit (OpenJDK) is an open source implementation of the Java Standard Edition (Java SE) platform with contribution from Oracle and the open Java community. For more information, see OpenJDK.
Open JavaFX (OpenJFX) is an open source, next generation client application platform for desktop, mobile and embedded systems built on Java. For more information, see JavaFX.
Before JDK version 9, JavaFX libraries were included in the JDK distribution. Since JDK version 9, JavaFX (JFX) is provided as a separate package.
This document explains how to install the OpenJDK version 12 along with OpenJFX libraries for the following operating systems:
Install OpenJDK
To install OpenJDK, you must download it as follow:
- Download the OpenJDK version 12 from https://jdk.java.net/archive/.
- Extract the .tar file. The
jdk-12.0.2
folder appears.
Install OpenJDK for Windows
This section explains how to install the OpenJDK version 12 for Windows:
-
Go to Start > Control Panel > System and Security > System.
-
Click Advanced system settings. The System Properties window appears.
-
Click Environment Variables.... The Environment Variables window appears.
-
Click New... in the User variables for <user name> section.
Note If yourJAVA_HOME
variable is already created, select it and click Edit.... -
Enter
JAVA_HOME
in the variable name field and the JDK directory path, for example,C:\Users\user\Desktop\jdk-12.0.2
, in the Variable value field. -
Click OK. The Environment Variables window appears.
-
If you cannot find
JAVA_HOME
in System variables section, add the variable by repeating the 4, 5, and 6 steps. -
Save and close the Environment Variables window.
-
Launch Command Prompt.
-
Run the following command to verify whether the OpenJDK version 12 is installed:
java -version
Install OpenJDK for Ubuntu
This section explains how to install the OpenJDK version 12 for Ubuntu:
-
Launch the Terminal application.
-
Run the following command in the terminal to set the
JAVA_HOME
as OpenJDK directory path, for example:JAVA_HOME=/home/<username>/Desktop/openJDK/jdk-12.0.2/
-
Run the following commands in the terminal:
sudo update-alternatives --install /usr/bin/java java ${JAVA_HOME}/bin/java 20000 sudo update-alternatives --install /usr/bin/javac javac ${JAVA_HOME}/bin/javac 20000
-
Run the following command to get a list of JDK versions installed:
sudo update-alternatives --config java
Note If there are multiple JDK installed, select the required java version by entering the selection number. -
Run the following command:
sudo update-alternatives --config javac
Notejavac
is for compilation. For more information on differences between java and javac, see https://docs.oracle.com. -
Select the required javac version as mentioned above.
-
Run the following command to verify whether the OpenJDK version 12 is installed:
java -version
Install OpenJDK for MacOS
This section explains how to install the OpenJDK version 12 for macOS:
-
Copy the downloaded jdk folder to the
Library/Java/JavaVirtualMachines
location. This is the default location where all the JDKs are available. Use the following command to copy the JDK directory.cp -aR <downloaded_jdk_path> /Library/Java/JavaVirtualMachines/
-
Launch Terminal application.
-
Run the following command to verify whether the OpenJDK version 12 is installed:
java -version
Note If the OpenJDK version 12 is not installed, add theexport JAVA_HOME = /Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home
command in the.profile
or.bash_profile
file.
Install OpenJFX
After installing OpenJDK, install the OpenJFX:
-
Download the OpenJFX version 11 from https://gluonhq.com/products/javafx.
Note Download the appropriate JavaFX product for your operating system. -
Extract the downloaded zip file.
-
Copy all files in
lib
folder tolib
folder ofJAVA_HOME
.NoteOn Ubuntu, run the following command:
cd javafx-sdk-11.0.1 sudo cp -arf lib/* ${JAVA_HOME}/lib/
-
Copy all files in
bin
folder tobin
folder ofJAVA_HOME
.Note This step is only required for Windows.