2

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.

danofsteel
  • 23
  • 1
  • 4

3 Answers3

8

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.

Be sure to choose “macOS”, “ARM 64-bit”, and “JDK FX” in the various pop-up menus of the download page.

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

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
swpalmer
  • 3,890
  • 2
  • 23
  • 31
6

Use a minimum JavaFX version of 17.0.2

I don't recommend trying to use JavaFX 11 on an M1 Mac.

As pointed out by swpalmer in his answer there is an Azul JDK FX Java 11 LTS distribution that includes JavaFX.

However, some earlier versions of JavaFX were coded for M1 macs, but they crashed, see the referenced question and related bug reports (which are numerous for the crash in the JavaFX bug tracker wiki):

It is possible that all relevant fixes are back-ported to the Azul JDK FX 11 LTS release, but I wouldn't rely on that.

When checking the JavaFX modules in Maven for the 11.0.2 release, there are no modules that support the M1 architecture. Also, there are no JavaFX 11 modules and no JavaFX 11 SDK available for download from Gluon that support the M1 architecture.

Instead, I recommend using a known good release that works on recent Mac M1 systems and Mac operating systems, which would be JDK 17+ and JavaFX 17.0.2+. The corresponding downloads are readily available:

Refer to the relevant documentation (at openjfx.io, Zulu or your IDE provider) on the installation and use of these distributions in your build environment.

Mixing recent JavaFX versions with older JDKs

You can run JavaFX 17.0.2+ on older JDKs, though I would recommend using recent versions of each.

I have tried such combinations (e.g. JavaFX 17.0.2 on JDK 11) on Intel Macs and they worked fine, but I have not tried these combinations on an M1 Mac as I don't have one.

JavaFX 17.0.2+ with support for M1 macs (aarch64 architecture) is available at the resources I linked in this answer.

JDK 11 and JRE 11 with support for M1 macs (aarch64 architecture) is available from various vendors (check with your JDK or JRE, e.g. Zulu or Liberica, distribution vendor to see installation instructions for these distributions on your platform).

Graphics pipeline failures when using recent JavaFX versions

You note that you tried the following distributions:

javafx-sdk-17.0.2 javafx-sdk-18

And it didn't work for you (reported "no suitable pipeline found").

I do not have an M1 mac to try to verify this.

I do not know the reason that the more recent JavaFX versions do not work for you. Perhaps you are trying to use an Intel architecture version of the SDK (e.g. x64) instead of an M1 compatible architecture version of the SDK (e.g. aarch64).

The JavaFX 18 release notes include an enhancement implemented in the release JDK-8278595 Provide more information when a pipeline can't be used. I guess it didn't help troubleshoot this issue ;-)

jewelsea
  • 150,031
  • 14
  • 366
  • 406
0

te problem is the version for javafx-controls, in pomxml, because by defaul maven use a version for intel, so change the version to 20-ea+11, and download the correct version.

<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-controls</artifactId>
    <version>20-ea+11</version>
</dependency>
  • 1
    What makes you believe that "maven use[s] a version for intel" and why should switching to the 20-ea+11 release fix that? – mipa Feb 20 '23 at 20:03