13

I encountered the following RuntimeException when starting an application which uses JavaFX 11+:

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:280)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:243)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
    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:567)
    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:94)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
    at java.base/java.lang.Thread.run(Thread.java:835)
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:567)
    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:272)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
    ... 5 more
pants
  • 192
  • 13
  • 1
    glad your found a solution :) you might consider to post it as an answer (to your own question) - doing so makes it more prominently recognizable to others – kleopatra Apr 08 '19 at 10:16
  • For those who are using Java 8. Try Installing Zulu version of JDK-FX (from https://www.azul.com/downloads/?package=jdk-fx) fixed it for me. Replace your old JDK config with this one I mean. It works for me. The rest answers are useless. – CoderLBY Jun 06 '23 at 07:39

6 Answers6

8

Download the JavaFX Windows SDK using the link below

https://gluonhq.com/products/javafx/

and use the options below in VM argument's when running FX Application

-p $ModuleFileDir$/lib/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.base,javafx.fxml,javafx.graphics,javafx.media,javafx.web --add-opens=javafx.graphics/javafx.scene=ALL-UNNAMED --add-exports javafx.base/com.sun.javafx.event=ALL-UNNAMED

Note: Don't change anything in the downloaded folder: use as it is. The DLL files are important; if the DLL files are missing then the above error pops up.

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
  • 2
    Your note was key. I didn't use anything other than the `--add-modules` though. No opens or export. – Scratte May 02 '20 at 07:32
6

I faced the same issue. It turns out I had downloaded the aarch64 version instead of x64. https://gluonhq.com/products/javafx/

4

The solution that worked for me was to add the \bin directory of the JavaFX SDK to java.library.path. This has the same effect as copying the files from the bin folder to the path of JAVA_HOME but it keeps the change project-specific.

File -> Project Properties -> Run

-Djava.library.path="C:\path\to\javafx-sdk-11.0.2\bin"
Eric Ihli
  • 1,722
  • 18
  • 30
3

After downloading JavaFX 11+, extract the file, and when the file is extracted, switch to IntelliJ IDEA. Then follow the steps below in IntelliJ IDEA.

  1. File
  2. Project Structure
  3. Global Libraries
  4. Press the "+" sign and then Java
  5. Go to the JavaFX 11+ folder you have just downloaded. Go into the Folder and now go into "lib" and select all of these files in the Folder except "src.zip", and press "OK" in the bottom right corner and save it as "javafx12".
  6. Now you move the mouse pointer under the "+" and press right click on the Librarie that you named as "javafx12", now a small window opens with different options but you press the mouse pointer on "Add to Modules" after you did that you move the mouse pointer to the "src" Folder and right-click with the mouse. Now open a wide window with various options but you choose the "New" option, now has opened a wide window with many different options but you choose again "module-info.java" and now you copy this text:

    module YOUR-PROJECT-NAME {
    
        requires javafx.graphics;
        requires javafx.controls;
        requires javafx.media;
        requires javafx.base;
        requires javafx.web;
        requires javafx.swing;
        requires javafx.fxml;
    
        opens application;
    }
    

This resolves the problem.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
1

I strongly recommend using maven for creating the JavaFX program. The approach is illustrated in the Intellij workshop on JavaFX. link However; there is a simple solution to this problem. you have to extract all content of the JavaFX SDK; then add libraries without removing or changing other subfolders. if you just copy the lib subfolder, it will not address folders in the bin subfolder

-1

You don't have to include everything in the module-info, only the pieces that you use. The minimum seems to be base, controls, and graphics. (My code uses those and fxml.) For example, if you're not using swing or media, javafx.swing and javafx.media may be omitted. The rendering toolkit, the part that wasn't found, is in the Windows-specific binary. It's in the javafx-sdk/bin directory. That directory has to be part of java.library.path. If you're using modules, javafx-sdk/lib may be part of the module-path. (Of course, the particular version is part of the javafx-sdk directory name.)