How to run javaFx application against gtk 3 libs?


How to force javaFx application use gtk3 libs? I know that SWT allows to set SWT_GTK3=1 environmental variable for that purpose. Is there any similar possibility / workaround for javaFx?

1/14/2014 7:48:50 AM

Accepted Answer

JavaFX uses GTK2 libraries and is unlikely to switch in the near future. Here is the related issue -

UPDATE: the JavaFX bugs are now on

in the last issue there is a comment

Since mixing GTK2 and GTK3 in the same application causes this problem, we might have to deliver two native libraries, one for GTK2 and one for GTK3

So, in the long run (JDK 9 release) it might be possible to run against GTK3

== UPDATE (11.05.2016)

New feature (8087516: Conditional support for GTK 3 on Linux) allows us to use either GTK v2 or 3 with JavaFX. The default has not changed - gtk 2 will be used by preference.

-Djdk.gtk.verbose=true // Output the version detected and used

-Djdk.gtk.version=3 // Toggles the preferred version to GTK 3

More details can be found here

5/11/2016 10:31:47 AM

Your best chance is to talk to the Java-Gnome guys. They implemented their library that makes it possible to write Java apps with GTK interfaces. Should be a possible extension to also support JavaFX.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow