My Oracle Support Banner

Java.lang.InternalError: java.home property not set when running native image of an AWT/Swing example on Windows (Doc ID 2987119.1)

Last updated on NOVEMBER 14, 2023

Applies to:

Oracle GraalVM Enterprise Edition - Version Oracle GraalVM Enterprise Edition 21.3.0 and later
Microsoft Windows x64 (64-bit)

Symptoms

Running some AWT/Swing examples as native image results in the following error:

-------------
Exception in thread "AWT-EventQueue-0" java.lang.InternalError: java.lang.reflect.InvocationTargetException
  at java.desktop@17.0.9/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:87)
  at java.base@17.0.9/java.security.AccessController.executePrivileged(AccessController.java:171)
  at java.base@17.0.9/java.security.AccessController.doPrivileged(AccessController.java:318)
  at java.desktop@17.0.9/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:75)
  at java.desktop@17.0.9/sun.font.SunFontManager.getInstance(SunFontManager.java:248)
  at java.desktop@17.0.9/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:266)
  at java.desktop@17.0.9/sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1242)
  at java.desktop@17.0.9/javax.swing.JComponent.getFontMetrics(JComponent.java:1691)
  at java.desktop@17.0.9/sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:355)
  at java.desktop@17.0.9/sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:327)
  at java.desktop@17.0.9/javax.swing.plaf.basic.BasicLabelUI.paint(BasicLabelUI.java:187)
  at java.desktop@17.0.9/javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
  at java.desktop@17.0.9/javax.swing.JComponent.paintComponent(JComponent.java:842)
  at java.desktop@17.0.9/javax.swing.JComponent.paint(JComponent.java:1119)
  at java.desktop@17.0.9/javax.swing.JComponent.paintChildren(JComponent.java:952)
  at java.desktop@17.0.9/javax.swing.JComponent.paint(JComponent.java:1128)
  at java.desktop@17.0.9/javax.swing.JComponent.paintToOffscreen(JComponent.java:5311)
  at java.desktop@17.0.9/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1657)
  at java.desktop@17.0.9/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1632)
  at java.desktop@17.0.9/javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1570)
  at java.desktop@17.0.9/javax.swing.RepaintManager.paint(RepaintManager.java:1337)
  at java.desktop@17.0.9/javax.swing.JComponent._paintImmediately(JComponent.java:5259)
  at java.desktop@17.0.9/javax.swing.JComponent.paintImmediately(JComponent.java:5069)
  at java.desktop@17.0.9/javax.swing.RepaintManager$4.run(RepaintManager.java:879)
  at java.desktop@17.0.9/javax.swing.RepaintManager$4.run(RepaintManager.java:862)
  at java.base@17.0.9/java.security.AccessController.executePrivileged(AccessController.java:171)
  at java.base@17.0.9/java.security.AccessController.doPrivileged(AccessController.java:399)
  at java.base@17.0.9/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
  at java.desktop@17.0.9/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:862)
  at java.desktop@17.0.9/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:835)
  at java.desktop@17.0.9/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:784)
  at java.desktop@17.0.9/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1898)
  at java.desktop@17.0.9/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
  at java.desktop@17.0.9/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
  at java.desktop@17.0.9/java.awt.EventQueue$4.run(EventQueue.java:722)
  at java.desktop@17.0.9/java.awt.EventQueue$4.run(EventQueue.java:716)
  at java.base@17.0.9/java.security.AccessController.executePrivileged(AccessController.java:171)
  at java.base@17.0.9/java.security.AccessController.doPrivileged(AccessController.java:399)
  at java.base@17.0.9/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
  at java.desktop@17.0.9/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
  at java.desktop@17.0.9/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
  at java.desktop@17.0.9/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
  at java.desktop@17.0.9/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
  at java.desktop@17.0.9/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
  at java.desktop@17.0.9/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
  at java.desktop@17.0.9/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
  at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:807)
  at org.graalvm.nativeimage.builder/com.oracle.svm.core.windows.WindowsPlatformThreads.osThreadStartRoutine(WindowsPlatformThreads.java:179)
Caused by: java.lang.reflect.InvocationTargetException
  at java.base@17.0.9/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
  at java.base@17.0.9/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
  at java.desktop@17.0.9/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:85)
  ... 47 more
Caused by: java.lang.Error: java.home property not set
  at java.desktop@17.0.9/sun.awt.FontConfiguration.findFontConfigFile(FontConfiguration.java:181)
  at java.desktop@17.0.9/sun.awt.FontConfiguration.(FontConfiguration.java:98)
  at java.desktop@17.0.9/sun.awt.windows.WFontConfiguration.(WFontConfiguration.java:41)
  at java.desktop@17.0.9/sun.awt.Win32FontManager.createFontConfiguration(Win32FontManager.java:180)
  at java.desktop@17.0.9/sun.font.SunFontManager$2.run(SunFontManager.java:358)
  at java.desktop@17.0.9/sun.font.SunFontManager$2.run(SunFontManager.java:315)
  at java.base@17.0.9/java.security.AccessController.executePrivileged(AccessController.java:171)
  at java.base@17.0.9/java.security.AccessController.doPrivileged(AccessController.java:318)
  at java.desktop@17.0.9/sun.font.SunFontManager.(SunFontManager.java:315)
  at java.desktop@17.0.9/sun.awt.Win32FontManager.(Win32FontManager.java:88)
  ... 50 more
-------------

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.