Getting Started with JavaFX
Getting Started with JavaFX
Introduction
JavaFX allows you to create Java applications with a modern, hardware-accelerated user interface that is highly portable.
There is detailed reference documentation for JavaFX, and this short tutorial will show you how to write a JavaFX 15 application.
For information on how to run JavaFX applications on mobile platforms, please see Getting Started with Gluon Mobile.
For information on Long Term Support (LTS) for JavaFX 11, please see JavaFX Long Term Support options.
JavaFX builds on top of JDK and is a standalone component. There are 2 different options for developing JavaFX applications:
- Use the JavaFX SDK (choosing between 11 LTS, latest release 15.0.1 or an early access build).
- Use a build system (e.g. maven/gradle) to download the required modules from Maven Central (choosing as well between the same mentioned versions).
In any case, for both options, it is required to have a recent version of JDK 15, or at least JDK 11.
Install Java
Download an appropriate JDK for your operating system. The latest JDK can be downloaded from the official OpenJDK website.
Once installed, you can use the java command from your command line.
Check if the correct java version is installed. The following shows the output for OpenJDK 15:
$ java -version
openjdk version "15" 2020-09-15
OpenJDK Runtime Environment (build 15+36-1562)
OpenJDK 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)
You need to set the JAVA_HOME environment variable to the JDK installation directory. You can follow this guide to set JAVA_HOME for your platform.
Note: If your system has multiple versions of JDK installed, you need to make sure that the JAVA_HOME environment variable points to correct JDK. JavaFX 15 needs at least JDK 11.
Comments
Post a Comment