'Error initializing QuantumRenderer: no suitable pipeline found in Eclipse JavaFX

Showing "Error initializing QuantumRenderer: no suitable pipeline found" after running JavaFX application. I added required JavaFX jar files to the project and I don't know why this error occured.

Graphics Device initialization failed for :  d3d, 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


Solution 1:[1]

In Eclipse IDE create a java project like always and create a new library in Windows > Preferences and under Java > Build Path > User Libraries click on New... Name the library and add the .jar's clicking on Add External JARs... Go to the path where you unziped the javafx package and under lib select all the .jar's. click Open and Apply and Close. You can start importing javafx code. If you run the application will get an error "Error: JavaFX runtime components are missing, and are required to run this application" To fix this go to Run > Run Configurations. Create a new Configuration under Java Application On the right in the Arguments tab look for VM Arguments and add

--module-path "PATH_TO_YOUR_JAVAFX_LIB_FOLDER" --add-modules javafx.controls,javafx.fxml

where PATH_TO_YOUR_JAVAFX_LIB_FOLDER in my case would be "C:\Program Files\Java\jdk-11.0.14\openjfx-18.0.1_windows-x64_bin-sdk\javafx-sdk-18.0.1\lib". Apply the changes and Run First problem fix

Now, if you try to Export your project the IDE will show you a warning saying that the VM arguments will not be part of the runnable JAR and if you execute the jar you will face the same error: "Error: JavaFX runtime components are missing, and are required to run this application" I always check "copy the required libraries into a sub-folder next to the jar" in the export wizard. To fix the error create a new text file next to your exported .jar and name it with the .bat extension (in windows) Edit the .bat file and add:

java --module-path "PATH_TO_YOUR_JAVAFX_LIB_FOLDER" --add-modules javafx.controls,javafx.fxml -jar YOUR_PROJECT_NAME.jar

All done, but PATH_TO_YOUR_JAVAFX_LIB_FOLDER is in your machine, so what if you run the .jar in another machine?

java --module-path "YOUR_PROJECT_NAME_lib/" --add-modules javafx.controls,javafx.fxml -jar YOUR_PROJECT_NAME.jar

where YOUR_PROJECT_NAME_lib is in the same directory as the exported .jar

If run now you get the error

"Graphics Device initialization failed for : d3d, sw Error initializing QuantumRenderer: no suitable pipeline found ... "

This error happens because it doesn't find the natives(.dll), so, copy the folder bin under PATH_TO_YOUR_JAVAFX paste it in the same folder of the exported .jar file

This should do the trick. Hope this help you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Max