7

I'm trying to create a JavaFX project in IntelliJ IDEA, but I get errors every time.

After completing tutorial https://openjfx.io/openjfx-docs/#IDE-Intellij, I've got this:

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:280)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
    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: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:94)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
    at java.base/java.lang.Thread.run(Thread.java:834)
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: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

Process finished with exit code 1

After adding -Dprism.verbose=true to VM options in IntelliJ IDEA (so my VM options look like this:

--module-path /myPath/javafx-sdk-11.0.1/lib --add-modules=javafx.controls,javafx.fxml -Dprism.verbose=true

And then I get this output:

Prism pipeline init order: es2 sw 
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline
java.lang.UnsatisfiedLinkError: no prism_es2 in java.library.path: [/Users/Lisa/javafx-sdk-11.0.1/lib]
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
    at java.base/java.lang.System.loadLibrary(System.java:1867)
    at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:150)
    at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
    at javafx.graphics/com.sun.prism.es2.ES2Pipeline.lambda$static$0(ES2Pipeline.java:68)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:50)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:315)
    at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
    at java.base/java.lang.Thread.run(Thread.java:834)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.sw.SWPipeline
java.lang.UnsatisfiedLinkError: no prism_sw in java.library.path: [/Users/Lisa/javafx-sdk-11.0.1/lib]
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
    at java.base/java.lang.System.loadLibrary(System.java:1867)
    at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:150)
    at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
    at javafx.graphics/com.sun.prism.sw.SWPipeline.lambda$static$0(SWPipeline.java:42)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:41)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:315)
    at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
    at java.base/java.lang.Thread.run(Thread.java:834)
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:280)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
    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: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:94)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
    at java.base/java.lang.Thread.run(Thread.java:834)
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: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

Process finished with exit code 1

What should I do to make my project work?

Naman
  • 27,789
  • 26
  • 218
  • 353
bolt
  • 387
  • 2
  • 6
  • 16
  • You say you have "completed" the tutorial. Does that mean that all the samples worked for you, but your new project fails? Or does it happen with the first sample you try? In any case, edit your question and specify how are you setting your project (modular/non-modular, using Gradle/Maven or none). – José Pereda Nov 25 '18 at 12:44
  • @JoséPereda I'd faced a similar issue while trying to build from scratch a non-modular, IDE based JavaFX project using code from one of the SO questions. Adding the compiled classes' path to my modulepath at that point in time fixed the above issue. I would just want to make a point that IDE(intelliJ) generated commands does not look as appropriate to me. Maybe a lot of tweaking is still required while creating a simple JavaFX project with Java11 and IDEs. – Naman Nov 25 '18 at 12:48
  • @nullpointer The error seems related to missing native libraries from javafx.graphics on the module path, nothing to do with the classes of the project. – José Pereda Nov 25 '18 at 13:14
  • Дмитрий Меньшиков - Can you confirm that the `/lib` folder specified by you has *8 `jar`, 13 `dylib`, 1 `.propertes`, and a `src.zip`* within it? Just checking if the lib folder is appropriate or not, since updating a project I cloned with a lib folder to point to a lib folder that I downloaded online makes things work for me fine. – Naman Nov 25 '18 at 14:24
  • @nullpointer I have 8 jar, 1 .properties, src.zip and 22 .so. No dylib – bolt Nov 25 '18 at 14:28
  • @ДмитрийМеньшиков Probably you are running on linux? – Naman Nov 25 '18 at 14:30
  • @nullpointer No, its OS X – bolt Nov 25 '18 at 14:31
  • @ДмитрийМеньшиков In that case, can you make sure to download the appropriate SDK for Mac OS X from https://gluonhq.com/products/javafx/. That should fix it for you as well. – Naman Nov 25 '18 at 14:32
  • 1
    @nullpointer I don't know how, but I downloaded wrong files. It all worked with your link. Spent 3 days. Thanks a lot! – bolt Nov 25 '18 at 14:44

5 Answers5

6

As mentioned in the documentation of Run HelloWorld using JavaFX 11, the first step to start off with the project is to

Download an appropriate JavaFX runtime for your operating system and unzip it to a desired location.

Changing my links to an afresh platform specific downloaded SDK's /lib folder solved it for me, while I was previously trying to use the lib folder provided by another user.

Reason: There are dynamic libraries bundled with the SDK in the lib folder that we specify as an argument to the modulepath. These libraries are platform-wise bundled and hence an SDK or lib folder used cross-platform wouldn't be able to provide the dynamic libraries such as those mentioned in the error to load during the application startup.

Naman
  • 27,789
  • 26
  • 218
  • 353
  • @JoséPereda Have updated the answer, I am pretty confident the *platform specific* SDK binary could be the reason for this error since that is where the dynamic libraries are in use from, assuming the path specified to the VM arg `modulepath` is any way correct. You can also [read the comments](https://stackoverflow.com/questions/53467499/javafx-os-x-graphics-device-initialization-failed-for-es2-sw#comment93807409_53467499) from OP in the question. – Naman Nov 25 '18 at 14:39
  • What do you mean with `trying to use the lib folder provided by another`? Didn't you download the SDK for JavaFX 11 from the _appropriate_ site? – José Pereda Nov 25 '18 at 14:43
  • @JoséPereda I meant, while I'd cloned a repository that *another user* had shared in a question, which had `lib` folder within it. I tried pointing the `modulepath` to that `lib` folder within the repo, but that didn't work for me, since the expectation must have been to point to a lib folder that is platform specific to load the dynamic libraries, right? Then I downloaded the SDK from the site and pointed to downloaded SDK's lib folder and things worked fine. – Naman Nov 25 '18 at 14:45
  • Ok, if I get it right, you were cloning a project that has already cloned the SDK for a different platform than yours? I've also found projects with a `libs` folder with the jars _only_. It is a bad idea, as you are missing all the native libraries, which are of course platform-specific. – José Pereda Nov 25 '18 at 14:48
  • @JoséPereda Exactly. That's why I've highlighted the important parts from the documentation and added the reason for seeing such failures as well. Cleaning up the rest of it to decouple things and thanks for clarifying doubts. :) – Naman Nov 25 '18 at 14:53
  • Ok, maybe you can add the correct link to your answer as well, your quote does not include it. – José Pereda Nov 25 '18 at 14:56
  • @JoséPereda Done. Feel free to edit from the next time (only) if you're willing to. – Naman Nov 25 '18 at 15:00
  • Very true... don't take the "jar" files out of the "lib" folder and make them your library. Keep the "downloaded sdk" folder structure intact. – trilogy Jun 18 '19 at 13:54
3

I had the same problem recently, and after days of trying to figure out what it was, and after some puzzling around, I fixed it!.

It seems all those .dylib files, need permission!

Go to your javafx lib folder, and first be sure you have all the files there. (8 jar, 13 dylib, 1 zip, and 1 properties file). If not, redownload from Gluon's Website.

Now, select all the files and right-click, and select Open With, and choose Terminal. It will ask you if you want to open or cancel... click on open on all the alert windows, when that's done, try to run your project again, and this time it will work!

I wonder, how something like this is necessary, and it isn't anywhere to be found!

I hope all that have this issue, get's it fixed.

1

I ran into this exact error with an M1 MacBook Pro.

When I originally downloaded the JavaFX SDK (v17.0.1), I chose the aarch64 version for MacOS. After going through all the steps, I was getting this same error.

I resolved it by downloading the x64 version and replacing the old files. You can easily do this by pasting the new zip in the same directory as your "javafx-sdk-xx.x.x" folder, deleting that old folder, and then extracting the new one. It will have the same name and structure as the previous one.

Once the new files are extracted, your application should run as expected.

Spiderbait
  • 11
  • 3
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30852460) – AliNajafZadeh Jan 23 '22 at 14:18
1

Installing Zulu version of JDK-FX (from https://www.azul.com/downloads/?package=jdk-fx) fixed it for me.

unitaxus13
  • 11
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 12 '22 at 07:00
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31750336) – Mori May 16 '22 at 22:15
0

I had exactly this error when trying to run the build result of jlink. The reason was a typo in the --module-path. A symptom of this is that files like

libprism_common.dylib, libprism_es2.dylib, libprism_sw.dylib, libjavafx_font.dylib, libjavafx_iio.dylib

(and some more) are missing in the lib/ folder of the build result.

So I recommend to check that the indicated module path actually contains the openjfx modules:

javafx.base.jmod, javafx.controls.jmod, javafx.fxml.jmod,
javafx.graphics.jmod, javafx.media.jmod, javafx.swing.jmod,
javafx.web.jmod