If you have questions about JavaFX, please go to the forum.
Installing JavaFX
Use Table 1 to determine the JavaFX installation that best suits your needs, then follow the instructions to install JavaFX.
Table 1 JavaFX Installations
What do You Want to Do?
What to Install
You want to develop JavaFX applications using the latest JDK and NetBeans IDE.
You want to develop JavaFX applications using the latest JDK and have a Java IDE other than NetBeans IDE.
You want to develop JavaFX applications using either NetBeans IDE or the command line, and you are using a version of the JDK older than 7u2.
You only want to run JavaFX applications.
Install the Standalone JavaFX Runtime. If you installed the JavaFX SDK, then you do not need to download the JavaFX Runtime separately.
Install the JDK + JavaFX SDK Bundle
The JavaFX SDK and Runtime are included in the JDK, starting with Java SE 7 Update 2. Download the JDK bundle from the JavaFX Downloads page, then go to the JDK Installation Guide.
Install the Standalone JavaFX SDK
The standalone JavaFX SDK should only be installed if you are using a JDK older than 7u2.
To install the JavaFX SDK:
Find the JavaFX SDK downloads, click the link for your operating system, and follow the prompts to save the executable file.
Run the .exe file and complete the steps in the installation wizard.
The default installation directory for the SDK is C:\Program Files\Oracle\JavaFX 2.0 SDK. See JavaFX Samples for the directories and content.
The default installation directory for the Runtime is C:\Program Files\Oracle\JavaFX 2.0 Runtime.
Install the Standalone JavaFX Runtime
The standalone JavaFX Runtime should only be installed if you are an older version of the JDK than 7u2 and do not plan to install the JavaFX SDK.
To install the JavaFX Runtime:
Find the JavaFX Runtime downloads, click the link for your operating system, and follow the prompts to save the executable file.
Run the .exe file.
The default installation directory is C:\Program Files\Oracle\JavaFX 2.0 Runtime.
Install NetBeans IDE
JavaFX 2.0.2 requires NetBeans IDE 7.1 (at least a prerelease version), which you can download from the JavaFX Downloads page.
See Setting Up NetBeans IDE With JavaFX for troubleshooting information.
JavaFX Samples
Sample JavaFX applications are available to download from the JavaFX Downloads page. Download the zip file that contains the samples and extract the files to your file system.
To run the samples, you must have the JavaFX Runtime installed. To run a sample on your desktop, click the .jar file for the sample.
Source code for each sample is in the javafx-samples- version \src directory. To view the source code, go to the javafx-samples- version \src\ sample directory, where sample is the name of the application in which you are interested. Each of the sample source directories is a NetBeans project.
You must have NetBeans IDE 7.1 (at least a prerelease version) to build the samples in the IDE. The NetBeans download is available from the JavaFX Download page.
JavaFX SDK File Structure
By default, the JavaFX SDK software is installed at C:\Program Files\Oracle\JavaFX 2.0 SDK. It contains the directories and content shown in Figure 1.
Figure 1 Directories and Content of the JavaFX SDK
Description of «Figure 1 Directories and Content of the JavaFX SDK»
SDK build tools.
JavaFX Runtime directory.
Ant tasks used by NetBeans for packaging and deployment.
Copyright information for the readme.html document.
A pointer to this document, which provides information about the JavaFX SDK.
License information for third-party software included in the JavaFX SDK.
Uninstall JavaFX
To uninstall JavaFX, use the standard uninstall process for your operating system. You must uninstall the JavaFX SDK and Runtime separately.
Введение в Java FX
Что такое Java FX
JavaFX представляет инструментарий для создания кроссплатформенных графических приложений на платформе Java.
JavaFX позволяет создавать приложения с богатой насыщенной графикой благодаря использованию аппаратного ускорения графики и возможностей GPU.
С помощью JavaFX можно создавать программы для различных операционных систем: Windows, MacOS, Linux и для самых различных устройств: десктопы, смартфоны, планшеты, встроенные устройства, ТВ. Приложение на JavaFX будет работать везде, где установлена исполняемая среда Java (JRE).
JavaFX предоставляет большие возможности по сравнению с рядом других подобных платформ, в частности, по сравнению со Swing. Это и большой набор элементов управления, и возможности по работе с мультимедиа, двухмерной и трехмерной графикой, декларативный способ описания интерфейса с помощью языка разметки FXML, возможность стилизации интерфейса с помощью CSS, интеграция со Swing и многое другое.
История JavaFX фактически началась в первой половине 2000-х годов, когда разработчик по имени Крис Оливер (Chris Oliver), будучи работником компании SeeBeyond, разработал для создания графических интерфейсов новый язык F3 (Froms Follows Functions). Впоследствии в 2005 году SeeBeyond была приобретена компанией Sun Microsystems (которая на тот момент развивала язык Java до покупки компанией Oracle). F3 был переименован в JavaFX, а Крис Оливер продолжил работу над новой платформой уже в рамках компании Sun. И в мае 2007 года Sun Microsystems публично анонсировала новую платформу для создания графических приложений. А 4 декабря 2008 года вышел JavaFX 1.0 SDK.
После приобретения Sun Microsystems компанией Oracle в 2010 году была анонсирована, а в 2011 году вышла в релиз версия JavaFX 2.0. В первой версии JavaFX фактически представлял скиптовый язык. Во второй версии был полностью изменен подход. Скриптовый язык был убран, а платформа была полностью переписана фактически с нуля. Теперь создавать приложения можно было с помощью любого языка, который поддерживала JVM. Были добавлены новые API, интеграция со Swing и много других вещей.
Следующими важными вехами в развитии платформы стали версии JavaFX 8 и особенно JavaFX 9, которая вышла в сентябре 2017 года вместе с Java 9 и привнесла в платформу модульность. И если раньше JavaFX поставлялась вместе с Java SE, то сейчас JavaFX отделена от основной функциональности Java SE и используется как отдельный модуль. Последняя версия фреймворка — JavaFX 15 — вышла в сентябре 2020 года.
На данный момент JavaFX представляет предпочтительный способ для создания графических приложений с помощью языка Java, который пришел на смену AWT и Swing. Также стоит отметить, что для работы с JavaFX вместо Java теоретически можно использовать любой язык программирования, который поддерживается JVM.
Установка инструментария
Что необходимо для работы с JavaFX? Прежде всего необходимо установить последнюю версию JDK с официального сайта Oracle: http://www.oracle.com/technetwork/java/javase/downloads/index.html. Согласно документации, вместе с JavaFX 15 можно использовать JDK 11, но лучше установить последнюю версию JDK — на данный момент это JDK 15.
Кроме того, даже после установки важно убедиться, что именно она и будет использоваться. В частности, системная переменная JAVA_HOME должна хранить путь к папке bin установленной версии JDK.
Проверить, какая версия Java используется на глобальном уровне, можно выполнив в консоли/командной строке команду:
JavaFX SDK
Также необходимо загрузить последнюю версию JavaFX SDK с адреса https://gluonhq.com/products/javafx/.
Например, если 64-х разрядная OC Windows, то соответственно надо загрузить JavaFX Windows x64 SDK. По сути SDK представляет архив с файлами, и после его загрузки его необходимо распаковать в любое предпочтительное место на жестком диске. Например, в моем случае SDK распакован в папку C:\javafx-sdk-15.0.1 .
Модули JavaFX
Если мы откроем папку lib в распакованном SDK, то мы увидим там модули, которые собственно и представляют JavaFX.
При написании кода приложений, а также при их компиляции и запуске мы будем использовать эти модули. Что они делают:
javafx.base : определяет базовый функционал фреймворка, в частности, функциональность привязки, свойств, коллекций, событий и т.д.
javafx.controls : определяет элементы управления, диаграммы и скины.
javafx.fxml : определяет функционал для работы с FXML.
javafx.graphics : определяет функциональность окон и контейнеров компоновки, жизненного цикла приложения, возможности рисования, пользовательского ввода, анимации, css и т.д.
javafx.media : определяет функционал для работы с мультимедиа.
javafx.swing : определяет интерфейс для взаимодействия и внедрения элементов Swing в приложении JavaFX.
javafx.web : определяет функционал WebView.
javafx-swt : модуль для взаимодействия с SWT.
Release: JavaFX 2.2
Last Updated: August 2012
[+] Show/Hide Table of Contents
JavaFX 2.2 Installation Guide
1 JavaFX Installation for Microsoft Windows
2 JavaFX Installation for Linux
3 JavaFX Installation for Mac OS X
We Welcome Your Comments
If you have questions about JavaFX, please go to the forum.
JavaFX 2.2 Installation Guide
1 JavaFX Installation for Microsoft Windows
This page provides information about the installing the JavaFX 2.2 SDK on Microsoft Windows.
See the following topics:
Download the JavaFX Installer that Meets Your Needs
How you install JavaFX depends on whether you can install Java SE 7 Update 6 (recommended).or need to use JDK 6.
You must upgrade to Java SE 7 Update 6 to take advantage of some JavaFX 2.2 features, such as the ability to package self-contained applications, as described in the JavaFX Deployment Guide.
Installing JavaFX 2.2 with Java SE 7 Update 6 (Recommended)
Java SE 7 Update 6 includes JavaFX 2.2. Go to the following location for download and installation information: http://www.oracle.com/technetwork/java/javase/downloads/
The Java SE 7u6 installer does not uninstall previous standalone versions of JavaFX. If you wish to uninstall previous standalone versions, see Uninstalling the Standalone JavaFX SDK and Runtime.
The JDK 7u6 installer installs the following components, in this order:
Java Development Kit (JDK), including the JavaFX SDK
Java Runtime Environment (JRE), including JavaFX
After installation, the JavaFX SDK and Runtime are integrated into the JDK and JRE directory structure. This is a change from previous versions of JavaFX, which were installed in directories independent from the JDK. The Java SE 7u6/JavaFX 2.2 installation is a true cobundle. For example, any file that was formerly in the \bin directory of the JavaFX SDK is now in the \bin directory of the JDK. For more information, see «JDK and JRE File Structure» at http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdkfiles.html
Installing JavaFX for Java SE 6
If you need to continue to use Java SE 6, you can install a standalone version of JavaFX 2.2.
The standalone JavaFX installer uninstalls any previous version of JavaFX SDK and JavaFX Runtime.
To download the installer, go to the following location and follow the link under the section «JavaFX 2.2 for Java SE 6»: http://www.oracle.com/technetwork/java/javafx/downloads/
There is a 32-bit or 64-bit JavaFX available. Use the bit version that matches that of your Java SE installation.
The default installation directories for standalone JavaFX installations are as follows:
The standalone JavaFX 2.2 SDK contains the directories and content shown in Figure 1-1.
Figure 1-1 File Structure of the Standalone JavaFX 2.2 SDK on Windows
Contains the JavaFX Packager tool for compiling, packaging, signing, and deploying JavaFX applications.
Contains the API documentation. For the online version of the API documentation and JavaFX tutorials, see http://docs.oracle.com/javafx/
Contains the following JavaFX utility jar files:
ant-javafx.jar: Ant tasks for packaging and deployment.
javafx-doclet.jar: A doclet for producing customized and nicely formatted documentation for the users of your JavaFX library.
javafx-mx.jar: A file used for debugging.
Contains a private, embedded copy of the JavaFX Runtime installation, used by JavaFX SDK development tools. You would typically point to the installed JavaFX Runtime instead, whose default location is C:\Program Files\Oracle\JavaFX 2.1 Runtime
Copyright information for the JavaFX software and documentation.
Provides a link to the README index page for the Java SE, JavaFX SDK, JavaFX Runtime.
License information for third-party software included in the JavaFX SDK.
Installing NetBeans IDE
NetBeans IDE 7.2 is recommended for JavaFX 2.2. Download it at http://netbeans.org/downloads/
For information about configuring NetBeans IDE to run with JavaFX, see «Setting Up NetBeans IDE With JavaFX» at http://netbeans.org/kb/docs/java/javafx-setup.html
JavaFX Scene Builder
JavaFX Scene Builder is a design tool for the JavaFX platform. You can download it from the following location: http://www.oracle.com/technetwork/java/javafx/downloads/index.html
Uninstalling the Standalone JavaFX SDK and Runtime
To uninstall the current and previous versions of the standalone JavaFX SDK and JavaFX Runtime, use the standard Windows Add/Remove Programs utility in Control Panel. You must uninstall the JavaFX SDK and Runtime separately.
Troubleshooting
Here are some tips for working around problems that are sometimes seen during or following an installation.
If you installed the 64-bit version, you may have problems with applications that run on 32 bits. Note that the 32-bit version is compatible with both 32-bit and 64-bit systems, but the reverse is not true. See the JavaFX Supported System Configurations at http://www.oracle.com/technetwork/java/javafx/downloads/supportedconfigurations-1506746.html
Check the system requirements to verify that you have a supported environment. Consult the appropriate system requirements document: