5 Migrating JavaFX 8 Applications to Newer JavaFX Releases

Take advantage of the latest features and enhancements of JavaFX by migrating for JavaFX 8 applications to JavaFX 26.

Note:

This section covers only the additional information specific to upgrading from JavaFX 8 to a newer standalone version of JavaFX that is available for newer JDK releases.

Upgrade Your JDK to the Latest JDK

See Migrating from JDK 8 to Later JDK Releases in Java Platform, Standard Edition Oracle JDK Migration Guide for information about migrating your application from JDK 8 to newer JDK releases.

Modify Your JavaFX 8 Applications for Newer JavaFX Releases

While Java generally provides backward compatibility when upgrading versions, migrating from JavaFX 8 to a current version of JavaFX is a significant change. Much has changed from JDK 8 to later releases. These changes include the following:

  • Modularization was introduced in JavaFX 9 as part of JDK 9. That version introduced encapsulation, which removed access to internal APIs that were unrestricted in JavaFX 8u.

  • Starting with JDK 11, JavaFX was unbundled from the JDK. JavaFX was redesigned to be available as a standalone library rather than being included with the JDK.

  • JavaFX has accumulated changes since JavaFX 11, including deprecations and new APIs.

  • The JavaFX API has evolved iteratively since JavaFX 8, and some APIs you are familiar with might have been removed or deprecated.

These changes are beneficial, but a few might require adjustments to application code.

See Deprecated API in the Java SE 26 JavaDoc API documentation for a list of deprecated classes and APIs.

See New API since JavaFX 9 for an exhaustive list of new JavaFX 26 classes and APIs

The following are the most important changes:

  • Encapsulation was introduced in JDK 9. It impacted JavaFX 8 in three ways:

    • It removed access to non-public APIs, including classes in com.sun.* packages.

    • It removed several deprecated and undocumented impl_* methods. See JDK-8144585.

    • It removed the internal Skin and CSS APIs from com.sun.javafx.scene.control.skin and com.sun.javafx.css.

      • APIs were added to provide replacements for earlier internal APIs:

        • A public Skin API was created in the javafx.scene.control.skin package, replacing the internal Skin classes formerly in com.sun.javafx.scene.control.skin. See JDK-8077916.

        • A public CSS API was created in the javafx.css package, replacing the internal CSS classes formerly in com.sun.javafx.css. See JDK-8077918.

  • The Java Deployment stack was removed in JDK 11. JavaFX applications can no longer run as applets or Java Web Start applications.

  • The JavaFX builder classes, which were deprecated in JDK 8, were removed in JDK 9. JavaFX applications that use the builder classes should instead construct the required scene graph objects directly and set properties with the equivalent method calls. See JDK-8092861.

  • Support for the VP6 video encoding format and the FXM/FLV container format has been removed in JavaFX Media. Use H.264/AVC1 in the MP4 container or HTTP Live Streaming instead. See JDK-8187637.

  • JavaFX Media support for libavcodec 53 and 55 was removed. These libraries are not present on supported Linux platforms by default and are no longer required. See JDK-8194062.

  • JavaFX requires GTK 3 on Linux. GTK 2 support was removed. See JDK-8299595.

  • The HostServices::getWebContext method, which was used only when running JavaFX as an applet, has been removed because applets are no longer supported. See JDK-8187149.

  • The Security Manager, which might have been used by some client applications, is no longer available. See JEP 486: Permanently Disable the Security Manager and The Security Manager Is Permanently Disabled in Java Platform, Standard Edition Security Developer's Guide.

New Experimental Features

Feature Module or API Description
RichTextArea (Incubator) jfx.incubator.richtext The RichTextArea control is designed for visualizing and editing rich text that can be styled in a variety of ways.
JavaFX Controls in the Title Bar (Preview) javafx.scene.layout.HeaderBar This preview feature defines a Stage style in which the client area is extended into the header bar area.

Build a JavaFX application with JavaFX 26

Starting with Java SE 17, the JavaFX library is delivered as an SDK and as a set of JMODs for each platform. You can use the SDK to compile and run JavaFX applications. See Use the JavaFX SDK to Compile and Run Your JavaFX Applications. You can use the JMODs with jlink to create a JDK that includes the JavaFX modules and, optionally, your modular application. See Create a JDK Using the JavaFX JMODs.

The JavaFX library is available as part of the Java Verified Portfolio.