{"record":{"id":"e47741fa0dd4d6c7","repo":"quarkusio/quarkus","slug":"aot-cache-generation-requires-building-with-jdk-25","errorCode":null,"errorMessage":"AOT cache generation requires building with JDK 25 or newer (see JEP 514). ","messagePattern":"AOT cache generation requires building with JDK 25 or newer \\(see JEP 514\\)\\. ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JvmStartupOptimizerArchiveBuildStep.java","lineNumber":330,"sourceCode":"                command\n                        .add(jarResult.getLibraryDir().getParent().resolve(FastJarFormat.QUARKUS_RUN_JAR)\n                                .getFileName().toString());\n            } else {\n                command.add(jarResult.getPath().getFileName().toString());\n            }\n        }\n\n        return launchArchiveCreateCommand(workingDirectory, appCDSPath, command);\n    }\n\n    /**\n     * @return The path of the created app.aot file or null if the file was not created\n     */\n    private Path createAot(JarBuildItem jarResult,\n            OutputTargetBuildItem outputTarget, String javaBinPath, String containerImage,\n            boolean isFastJar, List<String> additionalRecordingArgs) {\n        if (Runtime.version().feature() < 25) {\n            throw new IllegalStateException(\n                    \"AOT cache generation requires building with JDK 25 or newer (see JEP 514). \");\n        }\n        ArchivePathsContainer aotPathContainers = ArchivePathsContainer.aotFromQuarkusJar(jarResult.getPath());\n        return launchArchiveCreateCommand(aotPathContainers.workingDirectory, aotPathContainers.resultingFile,\n                createAotCommand(jarResult, outputTarget, javaBinPath, containerImage, isFastJar, additionalRecordingArgs,\n                        aotPathContainers));\n\n    }\n\n    private List<String> createAotCommand(JarBuildItem jarResult, OutputTargetBuildItem outputTarget, String javaBinPath,\n            String containerImage, boolean isFastJar, List<String> additionalRecordingArgs,\n            ArchivePathsContainer aotPathContainers) {\n        List<String> javaArgs = new ArrayList<>();\n        javaArgs.add(\"-XX:AOTCacheOutput=\" + aotPathContainers.resultingFile.getFileName().toString());\n        javaArgs.addAll(additionalRecordingArgs);\n        javaArgs.add(String.format(\"-D%s=true\", MainClassBuildStep.GENERATE_APP_CDS_SYSTEM_PROPERTY));\n        javaArgs.add(\"-jar\");\n","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JvmStartupOptimizerArchiveBuildStep.java#L312-L348","documentation":"Quarkus AOT cache generation (JEP 514, project Leyden premain caching) can only run when the JDK used to BUILD the application is JDK 25 or newer, because the AOT cache tooling (-XX:AOTCache) is only available from JDK 25. createAot checks Runtime.version().feature() and refuses to proceed on older JDKs, since launching the JVM with AOT options would fail or produce no cache.","triggerScenarios":"Building with quarkus.aot.enabled=true (or a quarkus:package goal/flag enabling AOT cache generation) while the build JDK's feature version is below 25.","commonSituations":"CI or developer machines still on JDK 21/17 LTS that enable AOT output; upgrading the project to use the AOT cache feature without upgrading the toolchain JDK.","solutions":["Set the build to run on JDK 25+ (update JAVA_HOME, maven-toolchains-plugin, or CI setup action to a JDK 25 release)","Disable AOT cache generation if JDK 25 is not available (remove quarkus.aot.enabled or the corresponding build flag)","Verify with mvn -version / java -version that the JDK performing the build (not just the runtime) is 25+"],"exampleFix":"// before (pom.xml, building on JDK 21 with AOT)\n<properties>\n  <maven.compiler.release>21</maven.compiler.release>\n</properties>\n// after\n<properties>\n  <maven.compiler.release>25</maven.compiler.release>\n</properties>\n<!-- plus run Maven itself on JDK 25: JAVA_HOME=/path/to/jdk-25 -->","handlingStrategy":"validation","validationCode":"int feature = Runtime.version().feature();\nif (feature < 25) {\n    throw new IllegalStateException(\"AOT cache requires JDK 25+, found \" + feature);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the build JDK via Maven toolchains to JDK 25+","Add a CI check asserting java -version >= 25 before AOT builds","Gate quarkus.aot.enabled behind a profile only active on JDK 25+ runners"],"tags":["jdk-version","aot-cache","build-time","native-compilation"],"backgroundTag":"unsupported-jdk-version","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}