{"record":{"id":"2e70f3fa3166fe7f","repo":"apache/iceberg","slug":"this-build-must-be-run-with-jdk-17-or-21-but-was-e","errorCode":null,"errorMessage":"This build must be run with JDK 17 or 21 but was executed with JDK ","messagePattern":"This build must be run with JDK 17 or 21 but was executed with JDK ","errorType":"console","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build.gradle","lineNumber":78,"sourceCode":"                              \"--add-opens\", \"java.base/java.math=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/java.net=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/java.nio=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/java.text=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/java.time=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/java.util.concurrent.atomic=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/java.util.concurrent=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/java.util.regex=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/java.util=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/jdk.internal.ref=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/jdk.internal.reflect=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.sql/java.sql=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/sun.util.calendar=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/sun.nio.ch=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/sun.nio.cs=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/sun.security.action=ALL-UNNAMED\",\n                              \"--add-opens\", \"java.base/sun.util.calendar=ALL-UNNAMED\"]\n} else {\n  throw new GradleException(\"This build must be run with JDK 17 or 21 but was executed with JDK \" + JavaVersion.current())\n}\n\ntasks.withType(AbstractArchiveTask).configureEach {\n  preserveFileTimestamps = false\n  reproducibleFileOrder = true\n}\n\napply plugin: 'com.gorylenko.gradle-git-properties'\n// git properties file for the root project for adding to the source tarball\ngitProperties {\n  gitPropertiesName = 'iceberg-build.properties'\n  gitPropertiesResourceDir = file(\"${rootDir}/build\")\n  extProperty = 'gitProps'\n  failOnNoGitDirectory = true\n  keys = ['git.branch', 'git.build.version', 'git.closest.tag.name','git.commit.id.abbrev', 'git.commit.id',\n          'git.commit.message.short', 'git.commit.time', 'git.tags']\n  version = projectVersion\n}","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/build.gradle#L60-L96","documentation":"Build-environment guard in build.gradle: the JVM running Gradle is neither JDK 17 nor JDK 21, which are the only supported versions for building this Iceberg checkout. The message reports the actual JDK; switch the launcher JVM (e.g. via JAVA_HOME or toolchains) and rerun.","triggerScenarios":"Running ./gradlew with JAVA_HOME pointing at JDK 8, 11, or a JDK newer than 21.","commonSituations":"Machine default JDK differs from project requirement; IDE Gradle JVM misconfigured; CI image with wrong Java toolchain.","solutions":["Set JAVA_HOME to a JDK 17 or 21 installation before running Gradle","Configure the Gradle JVM in the IDE to JDK 17/21","Use a toolchain/SDK manager (e.g. sdk, mise) to select the correct JDK","Pin a JDK 17/21 in CI images"],"exampleFix":"// before\nexport JAVA_HOME=/usr/lib/jvm/java-11-openjdk\n// after\nexport JAVA_HOME=/usr/lib/jvm/java-17-openjdk && ./gradlew build","handlingStrategy":"validation","validationCode":"if (!['17','21'].contains(JavaVersion.current().majorVersion)) {\n  println \"Use JDK 17 or 21; found ${JavaVersion.current()}\"\n  System.exit(1)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin JAVA_HOME in shell profile and CI to JDK 17/21","Set Gradle JVM in IDE project settings","Use .sdkmanrc or similar to pin toolchain per repo"],"tags":["gradle","jdk","build"],"backgroundTag":"unsupported-platform","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}