Issue
I have a problem running my application with JavaFX on mac M1.
Intellij screenshot
Even if I have downloaded the JavaFX SDK (aarch64 version) from the website, added as VM option in IntelliJ
--module-path "/Users/koloz/Downloads/javafx-sdk-18.0.1/lib" --add-modules=javafx.controls,javafx.fxml
and added the lib folder in the Project Structure -> Libraries
I still get this 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 [email protected]/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253)
at [email protected]/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:266)
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at [email protected]/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at [email protected]/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:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at [email protected]/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
at [email protected]/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:833)
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:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: No toolkit found
at [email protected]/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:278)
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at [email protected]/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at [email protected]/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
... 5 more
It seems to me that I have done all the things (also extracting the "src" lib that was zipped) read on the web, I wonder if it's an m1 problem, even if I run it with a jar file I get bugs.
Here is my command line command:
java --module-path /Users/koloz/Downloads/javafx-sdk-18.0.1/lib --add-modules=javafx.controls,javafx.fxml -jar /Users/koloz/Desktop/s/coding/ing-sw-2022-restelli-secchi-sica2/out/artifacts/Eriantys_jar2/Eriantys.jar
I've read that aarch64 is the right version for m1 mac here:
Any help?
Solution
Zulu provides JDK versions for M1 that include JavaFX.
That would allow you to execute your application with no additional setup.
Choose the following options when performing the Zulu JDK download:
- Java 18 (STS)
- macOS
- ARM 64-bit
- JDK FX
It is important to choose "JDK FX", not "JDK" as only the "JDK FX" distribution includes the JavaFX modules.
Asker reports, after switching to use the Zulu JDK FX distribution:
now it launches the application and something is shown!! But i still have bugs (IllegalStateException event loop object isn't active)
Answered By - jewelsea
Answer Checked By - Robin (JavaFixing Admin)