Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303493

Remove terminally deprecated JavaFX GTK 2 library



    • CSR
    • Resolution: Approved
    • P3
    • jfx21
    • javafx
    • None
    • behavioral
    • low
    • Gtk3 will be used instead. Gtk3 is available on all supported Linux distros.
    • System or security property, Other
    • JDK



      The JavaFX GTK library was marked for removal in JavaFX 18 as specified in JDK-8277962. The proposal is to remove it on JavaFX 21.


      Gtk2 is no longer maintained and continue to support it will hold back further improvements giving the burden to keep it compatible.

      Many efforts were done to make Gtk3 glass library stable enough so Gtk2 is not needed. See:


      The solution is to not build and distribute it. For this change, Gtk2 specific code will be kept (to be replaced or removed in the future).

      When requested by command like argument (jdk.gtk.version=2) a warning will be issued and gtk3 will be used instead.

      The minimum version required (at the time of this changes) is 3.8. It has been around since 2013 (announcement).


      If the JavaFX GTK 2 library is requested, Platform startup will issue an warning and use gtk3 instead, unless gtk2 is loaded.

      There are two major scenarios. On the first scenario platform startup is not interrupted and the application will run (if gtk3 is present on the system) - Case 1. On the second scenario, platform startup will be interrupted with an exception - those are Case 2, Case 3 and Case 4.

      Case 1: The application or end user has explicitly requested GTK 2 using the jdk.gtk.version system property, in which case warning messages will be issued and startup will proceed with gtk3:

      WARNING: A command line option tried to select the GTK 2 library, which was removed from JavaFX.
      WARNING: The GTK 3 library will be used instead.

      A similar warning will be issued in case of and invalid version is specified (in jdk.gtk.version):

      WARNING: A command line option tried to select an invalid GTK library version.
      WARNING: The GTK 3 library will be used instead.

      Case 2: Another native library has already loaded the GTK 2 library (an application cannot load both the GTK 2 and GTK 3 libraries in the same process).

      java.lang.UnsupportedOperationException: Unable to load glass GTK library.

      If verbose jdk.gtk.verbose=true

      found already loaded unsupported GTK library libgtk-x11-2.0.so.0

      Case 3: If the gtk3 libraries are not available on the system.

      java.lang.UnsupportedOperationException: Unable to load glass GTK library.

      Case 4: If Gtk3 in the system is not at leat 3.8:

      java.lang.UnsupportedOperationException: Minimum GTK version required is 3.8.0. System has 3.0.0.


        Issue Links



              tsayao Thiago Sayao
              kcr Kevin Rushforth
              Kevin Rushforth
              0 Vote for this issue
              3 Start watching this issue