diff --git a/changelog.html b/changelog.html index eb85bfc471..dd40be4795 100644 --- a/changelog.html +++ b/changelog.html @@ -61,6 +61,9 @@ Upcoming changes
  • Folder loading broken when child item loading throws exception. (issue 22811) +
  • + Amend JAVA_HOME check to work with JDK 9. + (issue 25601)
  • Better support functional tests from Gradle-based plugins. (issue 26331) diff --git a/core/src/main/java/hudson/model/JDK.java b/core/src/main/java/hudson/model/JDK.java index a06bac9c64..fe2152b8a6 100644 --- a/core/src/main/java/hudson/model/JDK.java +++ b/core/src/main/java/hudson/model/JDK.java @@ -182,7 +182,11 @@ public final class JDK extends ToolInstallation implements NodeSpecific, En @Override protected FormValidation checkHomeDirectory(File value) { File toolsJar = new File(value,"lib/tools.jar"); File mac = new File(value,"lib/dt.jar"); - if(!toolsJar.exists() && !mac.exists()) + + // JENKINS-25601: JDK 9+ no longer has tools.jar. Keep the existing dt.jar/tools.jar checks to be safe. + File javac = new File(value, "bin/javac"); + File javacExe = new File(value, "bin/javac.exe"); + if(!toolsJar.exists() && !mac.exists() && !javac.exists() && !javacExe.exists()) return FormValidation.error(Messages.Hudson_NotJDKDir(value)); return FormValidation.ok();