I have a simple JavaFX web browser that is a module. The directory structure of the module is:
webBrowser
webBrowser/module-info.java
webBrowser/webbrowser
webBrowser/webbrowser/WebBrowser.java
Here is the code to module-info.java
module webBrowser {
requires javafx.controls;
requires javafx.web;
exports webbrowser;
}
Here is the code to WebBrowser.java:
package webbrowser;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.scene.web.WebEngine;
import javafx.stage.Stage;
public class WebBrowser extends Application {
@Override
public void start(Stage stage) {
WebView browser = new WebView();
WebEngine webEngine = browser.getEngine();
webEngine.load("http://www.oracle.com");
Scene scene = new Scene(browser, 1200, 900);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
I compile my modular application with javac:
% javac -d out --module-source-path . --module-path $JAVAFX --module webBrowser
I'm able to launch my application with java and it works fine:
% java --module-path out:$JAVAFX/lib --module webBrowser/webbrowser.WebBrowser
The trouble starts when I try to assemble my module (webBrowser) and the JavaFX modules using jlink:
% jlink --module-path out:$JAVAFX/lib --add-modules webBrowser,javafx.controls,javafx.web --output myjre
% myjre/bin/java --list-modules
java.base@17.0.1
java.datatransfer@17.0.1
java.desktop@17.0.1
java.net.http@17.0.1
java.prefs@17.0.1
java.xml@17.0.1
javafx.base
javafx.controls
javafx.graphics
javafx.media
javafx.web
jdk.jsobject@17.0.1
jdk.unsupported@17.0.1
jdk.xml.dom@17.0.1
webBrowser
% myjre/bin/java --module webBrowser/webbrowser.WebBrowser
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
When running my linked application (above), I get this RuntimeException:
java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
Notes on assembly
I'm using jlink to assemble three modules: javafx.controls, javafx.web, and webBrowser.
Question
My application runs fine with Java. It launches and works correctly when I use this command:
% java --module-path out:$JAVAFX/lib --module webBrowser/webbrowser.WebBrowser
But I get an error message (Error initializing QuantumRenderer: no suitable pipeline found) when I try to launch the runtime image:
% myjre/bin/java --module webBrowser/webbrowser.WebBrowser
Why do I get this error message when I try to launch the runtime image? How can I get my web browser to assemble and launch correctly?