title: Custom JRE with JavaFX 11
body: <p>I'm Using JDK11 and JavaFX11.</p>
  <p>I created a custom JRE for my sample FX module program using Jlink, but when I try to run with the custom JRE, it renders errors as below:</p>
  <p>This is how I created my custom JRE (no errors):</p>
  <pre><code>jlink --module-path ..\jmods;%PATH_TO_FX% --add-modules java.base,java.desktop,jdk.unsupported,javafx.graphics --output FXJRE
  </code></pre>
  <p>This is how I tried to run (with errors):</p>
  <pre><code>FXJRE\bin\java --module-path %PATH_TO_FX%;mods -m com.javafxdemo/com.javafxdemo.JavaFXDemo
  </code></pre>
  <p>The error messages:</p>
  <pre><code>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: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 &quot;main&quot; 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
  </code></pre>
  <p>Here is how I compiled:</p>
  <p>The source JavaFXDemo.java:</p>
  <pre><code>package com.javafxdemo;
  
  import javafx.application.Application;
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.scene.Group;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.stage.Stage;
  
  public class JavaFXDemo extends Application {
      @Override
      public void start(Stage stage) {
          stage.setTitle(&quot;Hello World&quot;);
          Group root = new Group();
          Scene scene = new Scene(root, 300, 250);
          Button btn = new Button();
          btn.setLayoutX(100);
          btn.setLayoutY(80);
          btn.setText(&quot;Hello World&quot;);
          btn.setOnAction(actionEvent -&gt; System.out.println(&quot;Hello World&quot;));
          root.getChildren().add(btn);
          stage.setScene(scene);
          stage.show();
      }
      
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  <p><code>module-info.java</code>:</p>
  <pre><code>module com.javafxdemo {
      requires javafx.base;
      requires javafx.graphics;
      requires javafx.controls;
      
      exports com.javafxdemo;
  }
  </code></pre>
  <p>This is how I compiled.</p>
  <pre><code>javac -d mods\com.javafxdemo --module-path %PATH_TO_FX% src\com.javafxdemo\module-info.java src\com.javafxdemo\com\javafxdemo\JavaFXDemo.java
  </code></pre>
  <p>After compilation, I have module class files as below:</p>
  <pre><code>├───mods
  │   └───com.javafxdemo
  │       │   module-info.class
  │       │
  │       └───com
  │           └───javafxdemo
  │                   JavaFXDemo.class
  │
  └───src
      └───com.javafxdemo
          │   module-info.java
          │
          └───com
              └───javafxdemo
                      JavaFXDemo.java
  </code></pre>
  <p>I can successfully run as below:</p>
  <pre><code>java --module-path %PATH_TO_FX%;mods -m com.javafxdemo/com.javafxdemo.JavaFXDemo
  </code></pre>
  <p>I can run with the default JDK11 though.</p>
  <p>How can I successfully create a custom JRE and run the sample FX module program with it?</p>