Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8254843

Exception launching app on windows in some cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 16
    • 15, 16
    • tools
    • 15
    • b21
    • x86_64
    • windows

    Description

      If you create a jpackage app-image with --java-options option to define a splash screen, and if you have a jdk/bin in your path when launching the app, you get the exception.

      sample:
      prerequsite:
      "input" is a directory containing the files splash.png and SwingSet2_11.jar
      --------------
      export PATH=
      .../jdk-16/bin/jpackage --app-image -name ss16 --main-jar --java-options '-splash:$APPDIR/splash.png' \
      export PATH=.../jdk-16/bin
      ./ss16/ss16
      ---------------
      running ss16/ss16 results in splash screen showing, then:
      Exception in thread "AWT-EventQueue-0" java.lang.InternalError: java.lang.reflect
      .InvocationTargetException
              at java.desktop/sun.font.FontManagerFactory$1.run(Unknown Source)
              at java.base/java.security.AccessController.doPrivileged(Unknown Source)
              at java.desktop/sun.font.FontManagerFactory.getInstance(Unknown Source)
              at java.desktop/sun.font.SunFontManager.getInstance(Unknown Source)
              at java.desktop/sun.font.FontDesignMetrics.getMetrics(Unknown Source)
              at java.desktop/sun.swing.SwingUtilities2.getFontMetrics(Unknown Source)
              at java.desktop/javax.swing.JComponent.getFontMetrics(Unknown Source)
              at java.desktop/javax.swing.plaf.basic.BasicGraphicsUtils.getPreferredBut
      tonSize(Unknown Source)
              at java.desktop/javax.swing.plaf.basic.BasicButtonUI.getPreferredSize(Unk
      nown Source)
              at java.desktop/javax.swing.JComponent.getPreferredSize(Unknown Source)
              at java.desktop/javax.swing.plaf.metal.MetalDesktopIconUI.installComponen
      ts(Unknown Source)
              at java.desktop/javax.swing.plaf.basic.BasicDesktopIconUI.installUI(Unkno
      wn Source)
              at java.desktop/javax.swing.JComponent.setUI(Unknown Source)
              at java.desktop/javax.swing.JInternalFrame$JDesktopIcon.setUI(Unknown Sou
      rce)
              at java.desktop/javax.swing.JInternalFrame$JDesktopIcon.updateUI(Unknown
      Source)
              at java.desktop/javax.swing.JInternalFrame$JDesktopIcon.<init>(Unknown So
      urce)
              at java.desktop/javax.swing.JInternalFrame.<init>(Unknown Source)
              at java.desktop/javax.swing.JInternalFrame.<init>(Unknown Source)
              at InternalFrameDemo.createInternalFramePalette(InternalFrameDemo.java:17
      4)
              at InternalFrameDemo.<init>(InternalFrameDemo.java:120)
              at SwingSet2.preloadFirstDemo(SwingSet2.java:607)
              at SwingSet2.<init>(SwingSet2.java:183)
              at SwingSet2.lambda$main$1(SwingSet2.java:204)
              at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
              at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
              at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
              at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
              at java.base/java.security.AccessController.doPrivileged(Unknown Source)
              at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doInte
      rsectionPrivilege(Unknown Source)
              at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
              at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unkno
      wn Source)
              at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
      Source)
              at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unkno
      wn Source)
              at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
              at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
              at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
      Caused by: java.lang.reflect.InvocationTargetException
              at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstan
      ce0(Native Method)
              at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstan
      ce(Unknown Source)
              at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newIn
      stance(Unknown Source)
              at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown
      Source)
              at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
              ... 36 more
      Caused by: java.lang.InternalError: platform encoding not initialized
              at java.desktop/sun.awt.Win32FontManager.getFontPath(Native Method)
              at java.desktop/sun.font.SunFontManager.getPlatformFontPath(Unknown Sourc
      e)
              at java.desktop/sun.font.SunFontManager.getPlatformFontDirs(Unknown Sourc
      e)
              at java.desktop/sun.awt.Win32FontManager.getDefaultPlatformFont(Unknown S
      ource)
              at java.desktop/sun.font.SunFontManager$2.run(Unknown Source)
              at java.desktop/sun.font.SunFontManager$2.run(Unknown Source)
              at java.base/java.security.AccessController.doPrivileged(Unknown Source)
              at java.desktop/sun.font.SunFontManager.<init>(Unknown Source)
              at java.desktop/sun.awt.Win32FontManager.<init>(Unknown Source)
              ... 41 more

      --------------
      without the "export PATH=.../jdk-16/bin" SwingSet2 runs fine, splash shows, then SwingSet2 shows.




      Attachments

        Issue Links

          Activity

            People

              herrick Andy Herrick (Inactive)
              herrick Andy Herrick (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: