diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index 29a287fac687fe..fb8daf5b727cfd 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -834,6 +834,16 @@ public NativeImageInvokerInfo build() { addExperimentalVMOption(nativeImageArgs, "-H:+AllowFoldMethods"); + /* + * Foreign Function and Memory API in Native Image, JDK's JEP 454 + * This is needed for JDK 24+ internal native calls due to AWT, + * e.g. JDK-8337237 et al. + * + */ + if (graalVMVersion.compareTo(GraalVM.Version.VERSION_24_2_0) >= 0) { + addExperimentalVMOption(nativeImageArgs, "-H:+ForeignAPISupport"); + } + if (nativeConfig.headless()) { nativeImageArgs.add("-J-Djava.awt.headless=true"); }