JavaFX on Linux is showing a "Graphics Device initialization failed for : es2, sw"
I've just started coding/testing JavaFX stuff on Linux and I'm facing an error at time to start a simple app. I found many people concerning about that in Foruns but I could find a clear explanation about the reasons why it happens. I'd like to understand what is missing in my scenario to get it working.
Any suggestion will be really apreciated.
Env info:
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b123)
Java HotSpot(TM) Client VM (build 25.0-b65, mixed mode)
Linux MYServer 2.6.21-1.3228.fc7 #1 SMP Tue Jun 12 15:37:31 EDT 2007 i686 i686 i386 GNU/Linux
Exception:
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:300)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:244)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:179)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:210)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:653)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:314)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:98)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:128)
at java.lang.Thread.run(Thread.java:744)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:191)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:210)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:653)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:314)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
Solution 1:
You should have a look at this related bug for help on how to troubleshoot your issue. In summary, the recommendations are:
- run the application with the
-Dprism.verbose=true
flag - check the detailed log that is produced
- it may point to a missing graphics library: GTK 2.18 is required to run JavaFX on linux
Solution 2:
You need to install OpenJFX:
apt-get install openjfx
and then run the program.
Solution 3:
I solve this issue adding the libswt-gtk-3-java and gkt3 to my system.
Solution 4:
The problem can be in your old JRE version, which doesn't contain all the necessary libraries, such as libprism_es2.so
or libglass.so
, which should be located in /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64.
To check if this is the issue compile your Main.java
class from console
javac Main.java
java -Dprism.verbose=true Main
The output should possibly be java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libprism_es2.so
.
Download latest JRE from the official Oracle website and copy lib folder to your current JRE location. That should be enough.
Solution 5:
It was failing for me because i didnt have gtk libs. After enabling -Dprism.verbose=true
as mentioned by @assylias
i could find and installed the following packages.
sudo apt-get install libgtk2.0-bin libXtst6 libxslt1.1
It fixed the problem