Emre Uğur
Emre Uğur

Reputation: 81

Getting the "Graphics Device initialization failed for : es2, sw" error on my M1 MacBook when running a JavaFX Project

I am using Zulu openJdk 11 for Arm. I ve tried both in IntelliJ and VsCode butting getting the same exact error.(I'm using JavaFx SDK 11.0.2) Error Message (screenshot from visual studio code)

I would really appreciate any help, I've been trying to solve this issue for days but could not find any information for especially Apple Silicon.

Thanks in advance.

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 javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222) at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260) at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267) at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158) at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051) Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124) at java.base/java.lang.Thread.run(Thread.java:834) Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051) Caused by: java.lang.RuntimeException: No toolkit found at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272) at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267) at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158) at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363) ... 5 more

Code of the project(Copied it from oracle just to test mu setup):

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
 
public class JavaFX extends Application {
    public static void main(String[] args) {
        launch(args);
    }
    
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Hello World!");
        Button btn = new Button();
        btn.setText("Say 'Hello World'");
        btn.setOnAction(new EventHandler<ActionEvent>() {
 
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Hello World!");
            }
        });
        
        StackPane root = new StackPane();
        root.getChildren().add(btn);
        primaryStage.setScene(new Scene(root, 300, 250));
        primaryStage.show();
    }
}

Upvotes: 5

Views: 3315

Answers (3)

ttt
ttt

Reputation: 61

Just for reference: I'm not using M1, just updated the system to Big Sur. But you are right about 11.0.2's outdated. For Big Sur, 11.0.2 is likely to display garbled code instead of normal letters even if the fx running properly with the warning like "CoreText note: Client requested name ".SFNS-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:]. ". To deal with that, I updated 11.0.2 to 16 and everything went well.

Upvotes: 2

mipa
mipa

Reputation: 10640

For the M1 you have to download JavaFX Mac OS X AArch64 SDK version 17 build 14 (currently) which supports the Arm architecture. Why do you want to use an outdated version 11.0.2 anyway?

Upvotes: 3

ttt
ttt

Reputation: 61

I've updated the system and change the former fx jar then get those warnings similar to yours. (Big Sur 11.4) Here is the solution:

  1. Get to https://gluonhq.com/products/javafx/ and download the JDK again. Then follow this instruction and ass the path https://openjfx.io/openjfx-docs/#install-javafx I'm using eclipse, for me, I need to change my run configuration's argument into "-module-path="/Users/XXX/Documents/javafx-sdk-11.0.2/lib" --add-modules javafx.controls,javafx.fxml" after that, apply and run. Most likely you will get "“libprism_es2.dylib” cannot be opened because the developer cannot be verified." and “libprism_sw.dylib” cannot be opened because the developer cannot be verified." which is a step forward since they are exactly missing es2 and sw.
  2. Then follow this solution: “libprism_sw.dylib” cannot be opened because the developer cannot be verified. on mac JAVAFX and grant them the access(it take me a lot of times to repeat granting for multiple libs) Finally, fx is running!

Upvotes: 4

Related Questions