0

I am trying to make JavaFX work with VSCODE but I encounter this error;

I have the latest java installed "openjdk 17.0.1 2021-10-19" and I am using the latest javaFx17.0.1. I added all the references lib and added the vmArgs path file.

I am using the base model macbookpro m1.

This is my vmArgs path :

"vmArgs": "--module-path /Users/jeffreygrospe/Downloads/javafx-sdk-17.0.1/lib --add-modules javafx.controls,javafx.fxml",

This is what inside the javafx lib folder:

javafx-swt.jar      javafx.web.jar      libjfxmedia.dylib
javafx.base.jar     libdecora_sse.dylib libjfxmedia_avf.dylib
javafx.controls.jar libfxplugins.dylib  libjfxwebkit.dylib
javafx.fxml.jar     libglass.dylib      libprism_common.dylib
javafx.graphics.jar libglib-lite.dylib  libprism_es2.dylib
javafx.media.jar    libgstreamer-lite.dylib libprism_sw.dylib
javafx.properties   libjavafx_font.dylib
javafx.swing.jar    libjavafx_iio.dylib
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: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 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: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 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
jewelsea
  • 150,031
  • 14
  • 366
  • 406
jgrospe
  • 1
  • 3
  • Can you run your app with java -Djavafx.verbose=true -Dprism.verbose=true ... and edit the question to include the output? – jewelsea Nov 27 '21 at 19:30
  • My guess is that your vm args are wrong, edit the question to include them, also run an ls on the locations to see what is actually there and include that output in the question. – jewelsea Nov 27 '21 at 19:32
  • 1
    @jewelsea Hey, I added the informations that you asked, I hope that'll help to determine what causing the issue. Thanks for the help – jgrospe Nov 27 '21 at 21:30
  • I don't see anything wrong with the setup. There is a guide for [JavaFX setup of vscode](https://stackoverflow.com/questions/54349894/javafx-11-with-vscode), I guess you have already tried that. Could be an incompatibility with new M1 MacBook pros, but still likely a setup issue. I think the pipelines it is looking for are in either of the native code in these two libs on your module path libprism_es2.dylib, libprism_sw.dylib. Even if the hardware es2 pipeline failed, I think it would be able to fallback to the software sw pipeline. – jewelsea Nov 27 '21 at 22:03
  • Note if you [use the options I advised](https://github.com/javafxports/openjdk-jfx/issues/237) it will tell you exactly what libs it is trying to use. – jewelsea Nov 27 '21 at 22:06
  • @jewelsea could you explain to me how to run my app with this java -Djavafx.verbose=true -Dprism.verbose=true .. – jgrospe Nov 27 '21 at 23:21
  • I don’t know vs code, but they are Vm options to set system properties for debugging, so add them to the vmArgs. – jewelsea Nov 27 '21 at 23:24
  • 1
    @jewelsea I finally manage to have javafx work with VScode on Mac m1. With enough research, it was the JDK that was causing the error. I use "Liberica JDK 17.0.1+12, LTS" it works just fine. – jgrospe Nov 28 '21 at 06:04
  • 1
    Great :-) Using something like liberica which ships with JavaFX pre-installed makes things easier I think. If you want, you can add a [self-answer](https://stackoverflow.com/help/self-answer). – jewelsea Nov 28 '21 at 06:40

1 Answers1

0

I finally manage to have JavaFX work with VScode on Mac m1. With enough research, it was the JDK that was causing the error. I use "Liberica JDK 17.0.1+12, LTS" it works just fine.

Another option is to use Azul jdk v17.

jgrospe
  • 1
  • 3