Home > Software engineering >  Is it possible to run JavaFX with Java 11 on M1 Mac?
Is it possible to run JavaFX with Java 11 on M1 Mac?

Time:03-26

For the past few days I have been attemping to set up JavaFX on my M1 Mac. I was able to get it working using Java 18, but unfortunately I need to be using Java 11 for school.

I keep being given the following error:

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:283)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:254)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:264)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
        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:95)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.base/java.lang.Thread.run(Thread.java:829)
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:276)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
        ... 5 more

I have tried using various combinations of the following JavaFX versions:

javafx-sdk-11

javafx-sdk-11.0.2

javafx-sdk-17.0.2

javafx-sdk-18

and the following Java JDK versions:

temurin-11.jdk

zulu-11.jdk

but nothing I've tried has given me any success. I know for a fact that I have everthing installed properly (updating Run Configurations, etc.) so I don't think that should be an issue. I have tried using VSCode, Eclipse, and IntelliJ, but the results have been the same for all of them.

Is it even possible to run JavaFX with Java 11 on an M1 Mac or am I out of luck? Thanks in advance.

CodePudding user response:

I don't have an M1 Mac to test, but did you try the build of JDK 11 with JavaFX included that Azul provides? I saw that you mentioned zulu-11, just not sure if you picked the version with JavaFX bundled.

https://www.azul.com/downloads/?version=java-11-lts&os=macos&architecture=arm-64-bit&package=jdk-fx

CodePudding user response:

No (unless the fix mentioned below is backported) you can’t use JavaFX 11 on an M1 Mac.

You need JavaFX 17.0.2 and an M1 compatible JDK to run JavaFX on a M1 Mac.

Some earlier versions of JavaFX were coded for M1 macs, but they crashed:

  • Related