Javafx on Linux Is Showing a "Graphics Device Initialization Failed For: Es2, Sw"

JavaFX, OS X, Graphics Device initialization failed for : es2, sw

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.

javafx - Graphics Device initialization failed for : es2, sw M1 MacOS

Fixed it with setting the used JRE to the latest openjdk installed with brew.
Then I had to uncheck the Use the -XstartOnFirstThread argument when launching with SWT box in Run configurations in the VM tab, then it worked

How do I resolve Graphics Device initialization failed for : es2, sw when running on WSL?

While some may suggest you a workaround for this problem, I suggest you to take a look at aws-sts docker solution: it uses headless browser under the hood, so there won't be any problems related to the graphics and it is more or less platform independent.

I was exactly in the same situation using WSL, so what I did:

  • created config.json as described in the Readme
  • ReadMe suggests to create a Dockerfile, but actually I never had to use it just passing the config parameters to the basic docker image like in the template file

As the result, aws token is generated inside the docker container and put into mounted $HOME/.aws folder, so you can easily call awscli from WLS.

Here is how to make docker working properly with WLS (in short, client in WLS, server installed on Windows with exposed daemon).

One more hint: use --profile=default when generating token, so you don't have to specify it every time you use awscli.

How to solve the Graphics Device initialization failed for : d3d, sw Problem

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.



Related Topics



Leave a reply



Submit