Skip to content

[Native Image] ExceptionInInitializerError on SWT startup #12678

@kwillenson

Description

@kwillenson

Describe the Issue

Program starts then fails on SWT startup

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java version "25.0.1" 2025-10-21 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 25.0.1+8.1 (build 25.0.1+8-LTS-jvmci-b01)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 25.0.1+8.1 (build 25.0.1+8-LTS-jvmci-b01, mixed mode, sharing)

Operating System and Version

OS Name Microsoft Windows 11 Home Version 10.0.26100 Build 26100

Troubleshooting Confirmation

Run Command

LandMentor2020Native.exe --enable-native-access=ALL-UNNAMED

Expected Behavior

com.neighborhoodinnovations.ui.App.preApp(18632) LandMentor 2020 compiled at 2025-12-08 16:31:59.429
com.neighborhoodinnovations.ui.App.showScreenSize(18557) screenSize 1920, 1080, 96
NOTE: GUI starts here
com.neighborhoodinnovations.ui.App.createContents(17400) LandMentor 2020, compiled=2025-12-08 16:31:59.429
version=FULL, id=BC37-E795-C865-AEEF-7C9E-5DBC
started at 2025-12-08 17:25:26.663
com.neighborhoodinnovations.site.setup.Setup.(410) C:\Users\keith\AppData\Local\LMSetup/default.set exists, now read it
com.neighborhoodinnovations.site.setup.Setup.readExternal(1013) readExternal initialize screenDPI 0
com.neighborhoodinnovations.site.setup.Setup.(425) fileSetupVersion 20191011 Setup.VERSION_NUMBER 20191011
com.neighborhoodinnovations.site.setup.Setup.setSiteFileHome(14327) Setup.setSiteFileHome C:\Users\keith\AppData\Local\LMSetup
com.neighborhoodinnovations.site.setup.Setup.readExternal(1013) readExternal initialize screenDPI 0
com.neighborhoodinnovations.ui.App.createContents(17496) cleanupEventLogs
com.neighborhoodinnovations.site.setup.Setup.setSiteFileHome(14327) Setup.setSiteFileHome C:\Users\keith
com.neighborhoodinnovations.ui.App.createContents(17498) cleanupEventLogs done
com.neighborhoodinnovations.ui.App.createContents(17673) after verticalDesign 1705
com.neighborhoodinnovations.site.SiteLog.(321) rafFileName C:\Users\keith\AppData\Local\LMSetup\site1_20251208_0525.evt
com.neighborhoodinnovations.site.Site.load(22107) Site.load(site1)
com.neighborhoodinnovations.site.SiteLog.(321) rafFileName C:\Users\keith\AppData\Local\LMSetup\site1_20251208_0525.evt
com.neighborhoodinnovations.site.SiteLog.(321) rafFileName C:\Users\keith\AppData\Local\LMSetup\site_20251208_0525.evt
com.neighborhoodinnovations.site.SiteLog.close(367) SiteLog.close delete C:\Users\keith\AppData\Local\LMSetup\site_20251208_0525.evt
com.neighborhoodinnovations.site.SiteLog.(321) rafFileName null
com.neighborhoodinnovations.site.setup.Setup.setSiteFileHome(14327) Setup.setSiteFileHome C:\Users\keith

Actual Behavior

GUI does not get created. Program dies unexpectedly.

com.neighborhoodinnovations.ui.App.preApp(-1) LandMentor 2020 compiled at 2025-12-08 16:31:59.429
com.neighborhoodinnovations.ui.App.showScreenSize(-1) screenSize 1920, 1080, 96
Exception in thread "main" java.lang.ExceptionInInitializerError
at [email protected]/java.lang.Class.ensureInitialized(DynamicHub.java:778)
at org.eclipse.swt.internal.win32.STARTUPINFO.(Unknown Source)
at org.eclipse.swt.widgets.Display.(Unknown Source)
at com.neighborhoodinnovations.ui.App.getDisplay(Unknown Source)
at com.neighborhoodinnovations.ui.App.preApp(Unknown Source)
at com.neighborhoodinnovations.ui.App.main(Unknown Source)
at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.lang.NullPointerException
at org.eclipse.swt.internal.Library.isLoadable(Unknown Source)
at org.eclipse.swt.internal.Platform.exitIfNotLoadable(Unknown Source)
at org.eclipse.swt.internal.C.(Unknown Source)
... 7 more

Steps to Reproduce

  1. Compile program with native-image

    native-image --no-fallback --verbose -g -O0 -Dswt.library.path=D:\NeighborhoodInnovations_repository\land-mentor-Java23\target -Djava.awt.headless=false --enable-url-protocols=http,https -H:IncludeLocales=en,es,de -H:+UnlockExperimentalVMOptions "-H:NativeLinkerOption=D:\NeighborhoodInnovations_repository\land-mentor-Java23\target\LM.res" -H:ReflectionConfigurationResources=META-INF\native-image\reflect-config.json -H:Log=registerResource:5 -o .\LandMentor2020Native -cp "D:\NeighborhoodInnovations_repository\land-mentor-Java23\target\lib\app.jar;D:\NeighborhoodInnovations_repository\land-mentor-Java23\target\app-1-jar-with-dependencies.jar;." com.neighborhoodinnovations.ui.App

  2. Package program and supporting files with Inno Setup

  3. Install exe created by Inno Setup

  4. Run program (from desktop shortcut or from Command Prompt)

Additional Context

eclipse-SDK-4.37-win32-x86_64\eclipse
Instead of using org.eclipse.swt.win32.win32.x86_64_3.131.0.v20250820-1556.jar
I am extracting all files from org.eclipse.swt.win32.win32.x86_64.source_3.131.0.v20250820-1556.jar and compiling them with java from GraalVM 25.0.1+8.1 into the jar

The program runs perfectly in the development environment.

Run-Time Log Output and Error Messages

com.neighborhoodinnovations.ui.App.preApp(-1) LandMentor 2020 compiled at 2025-12-08 16:31:59.429
com.neighborhoodinnovations.ui.App.showScreenSize(-1) screenSize 1920, 1080, 96
Exception in thread "main" java.lang.ExceptionInInitializerError
at [email protected]/java.lang.Class.ensureInitialized(DynamicHub.java:778)
at org.eclipse.swt.internal.win32.STARTUPINFO.(Unknown Source)
at org.eclipse.swt.widgets.Display.(Unknown Source)
at com.neighborhoodinnovations.ui.App.getDisplay(Unknown Source)
at com.neighborhoodinnovations.ui.App.preApp(Unknown Source)
at com.neighborhoodinnovations.ui.App.main(Unknown Source)
at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.lang.NullPointerException
at org.eclipse.swt.internal.Library.isLoadable(Unknown Source)
at org.eclipse.swt.internal.Platform.exitIfNotLoadable(Unknown Source)
at org.eclipse.swt.internal.C.(Unknown Source)
... 7 more

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions