title: Javafx Shaded Jar Not Working when JAVA_HOME is pointing to JRE
body: <p>I have created a shaded jar which runs on java 11.
  Everything works fine when i have no other java version than 11 installed</p>
  <p>But when i also install and set java home to java 8</p>
  <p>JAVA_HOME: C:\jdk\ (Jar Working)</p>
  <p>JAVA_HOME: C:\jdk\jre\ (Jar Not Working shows blank screen)
  [1]: <a href="https://i.stack.imgur.com/s28ef.jpg" rel="nofollow noreferrer">https://i.stack.imgur.com/s28ef.jpg</a></p>
  <p>Note: c:\jdk is java 8 path</p>
  <p>Below is my pom for creating shaded jar</p>
  <pre><code>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;test&lt;/groupId&gt;
  &lt;artifactId&gt;test&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;test&lt;/name&gt;
  &lt;description&gt;test&lt;/description&gt;
  
  
  &lt;properties&gt;
      &lt;!-- Generic properties --&gt;
      &lt;java.version&gt;11.0.7&lt;/java.version&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  &lt;/properties&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.8.0&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;11&lt;/source&gt;
                  &lt;target&gt;11&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.2.1&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;java&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
  
                  &lt;mainClass&gt;GUIStarter&lt;/mainClass&gt;
                  &lt;systemProperties&gt;
                  &lt;systemProperty&gt;
                      &lt;key&gt;prism.allowhidpi&lt;/key&gt;
                      &lt;value&gt;false&lt;/value&gt;
                  &lt;/systemProperty&gt;
              &lt;/systemProperties&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.zenjava&lt;/groupId&gt;
              &lt;artifactId&gt;javafx-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;8.1.3-SNAPSHOT&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;mainClass&gt;GUIStarter&lt;/mainClass&gt;
                  &lt;bundler&gt;EXE&lt;/bundler&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.openjfx&lt;/groupId&gt;
              &lt;artifactId&gt;javafx-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;0.0.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;options&gt;
                      &lt;option&gt;--add-opens&lt;/option&gt;
                      &lt;option&gt;javafx.graphics/javafx.css=ALL-UNNAMED&lt;/option&gt;
                      &lt;option&gt;--add-opens&lt;/option&gt;
                      &lt;option&gt;javafx.base/com.sun.javafx.runtime=ALL-UNNAMED&lt;/option&gt;
                      &lt;option&gt;--add-opens&lt;/option&gt;
                      &lt;option&gt;javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED&lt;/option&gt;
                      &lt;option&gt;--add-opens&lt;/option&gt;
                      &lt;option&gt;javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED&lt;/option&gt;
                      &lt;option&gt;--add-opens&lt;/option&gt;
                      &lt;option&gt;javafx.base/com.sun.javafx.binding=ALL-UNNAMED&lt;/option&gt;
                      &lt;option&gt;--add-opens&lt;/option&gt;
                      &lt;option&gt;javafx.base/com.sun.javafx.event=ALL-UNNAMED&lt;/option&gt;
                      &lt;option&gt;--add-opens&lt;/option&gt;
                      &lt;option&gt;javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED&lt;/option&gt;
                      &lt;option&gt;--add-exports&lt;/option&gt;
                      &lt;option&gt;javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix&lt;/option&gt;
                      &lt;option&gt;--add-exports&lt;/option&gt;
                      &lt;option&gt;javafx.controls/com.sun.javafx.scene.control=com.jfoenix&lt;/option&gt;
                      &lt;option&gt;--add-exports&lt;/option&gt;
                      &lt;option&gt;javafx.base/com.sun.javafx.binding=com.jfoenix&lt;/option&gt;
                      &lt;option&gt;--add-exports&lt;/option&gt;
                      &lt;option&gt;javafx.graphics/com.sun.javafx.stage=com.jfoenix&lt;/option&gt;
                      &lt;option&gt;--add-exports&lt;/option&gt;
                      &lt;option&gt;javafx.base/com.sun.javafx.event=com.jfoenix&lt;/option&gt;
                  &lt;/options&gt;
                  &lt;mainClass&gt;GUIStarter&lt;/mainClass&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.0.0&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;shade&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;options&gt;
                              &lt;option&gt;--add-opens&lt;/option&gt;
                              &lt;option&gt;javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix
                              &lt;/option&gt;
                              &lt;option&gt;--add-opens&lt;/option&gt;
                              &lt;option&gt;javafx.controls/com.sun.javafx.scene.control=com.jfoenix
                              &lt;/option&gt;
                          &lt;/options&gt;
                          &lt;transformers&gt;
                              &lt;transformer
                                  implementation=&quot;org.apache.maven.plugins.shade.resource.ManifestResourceTransformer&quot;&gt;
                                  &lt;manifestEntries&gt;
                                  &lt;Multi-Release&gt;true&lt;/Multi-Release&gt;
                                  &lt;Main-Class&gt;GUIStarter&lt;/Main-Class&gt;
                                  &lt;/manifestEntries&gt;
  
                              &lt;/transformer&gt;
                          &lt;/transformers&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>I Tried executing Jar from Command Prompt getting below exception on startup</p>
  <pre><code>java.lang.NullPointerException
      at com.sun.javafx.font.directwrite.DWGlyph.createBitmap(DWGlyph.java:287)
      at com.sun.javafx.font.directwrite.DWGlyph.getCachedBitmap(DWGlyph.java:273)
      at com.sun.javafx.font.directwrite.DWGlyph.getD2DMask(DWGlyph.java:167)
      at com.sun.javafx.font.directwrite.DWGlyph.getPixelData(DWGlyph.java:352)
      at com.sun.prism.impl.GlyphCache.getCachedGlyph(GlyphCache.java:258)
      at com.sun.prism.impl.GlyphCache.render(GlyphCache.java:148)
      at com.sun.prism.impl.ps.BaseShaderGraphics.drawString(BaseShaderGraphics.java:2101)
      at com.sun.javafx.sg.prism.NGText.renderText(NGText.java:312)
      at com.sun.javafx.sg.prism.NGText.renderContent2D(NGText.java:270)
      at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:261)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
      at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
      at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
      at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
      at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:479)
      at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:328)
      at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
      at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
      at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>