Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run javaFx application against gtk 3 libs?

Tags:

java

javafx

gtk

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?

like image 508
Ilya Buziuk Avatar asked Jan 13 '14 14:01

Ilya Buziuk


People also ask

Does JavaFX use GTK?

[ Also on InfoWorld: The best open source software of 2021 ] "There are a number of Java packages that use GTK. These include AWT/Swing, JavaFX, and SWT.

Is JavaFX library or API?

JavaFX is a Java library that consists of classes and interfaces that are written in native Java code. The APIs are designed to be a friendly alternative to Java Virtual Machine (Java VM) languages, such as JRuby and Scala. FXML and Scene Builder.

Is JavaFX a backend?

JavaFX Is JavaThe integration of back-end services is both protocol- and technology-agnostic. Services involve various configurations such as IP addresses, ports, and property files. And the methods of the APIs often throw protocol-specific exceptions such as java. rmi.


1 Answers

JavaFX uses GTK2 libraries and is unlikely to switch in the near future. Here is the related issue - https://javafx-jira.kenai.com/browse/RT-35264

UPDATE: the JavaFX bugs are now on bugs.openjdk.java.net:

  • https://bugs.openjdk.java.net/browse/JDK-8088966 (closed as duplicate)
  • https://bugs.openjdk.java.net/browse/JDK-8089584 (open)

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

like image 175
Ilya Buziuk Avatar answered Oct 19 '22 11:10

Ilya Buziuk