From 1186e7b4047a70162a1a3be399fc449ae3b0e1f5 Mon Sep 17 00:00:00 2001 From: Daniel Beck Date: Sun, 21 Dec 2014 04:20:45 +0100 Subject: [PATCH] [FIXED JENKINS-25601] Amend JAVA_HOME check to work with JDK 9 --- core/src/main/java/hudson/model/JDK.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); -- GitLab