Skip to content

Commit e4f6eae

Browse files
Fix Runtime Java Path for OSX in Gradle (#49245) (#49246)
On OSX the `bin` directory is nested under `Contents/Home` relative to where it is for the other platforms.
1 parent 288217e commit e4f6eae

File tree

1 file changed

+3
-1
lines changed
  • buildSrc/src/main/java/org/elasticsearch/gradle

1 file changed

+3
-1
lines changed

buildSrc/src/main/java/org/elasticsearch/gradle/Jdk.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ public Object getBinJavaPath() {
115115
return new Object() {
116116
@Override
117117
public String toString() {
118-
return getPath() + "/bin/java";
118+
final String platform = getPlatform();
119+
final boolean isOSX = "mac".equals(platform) || "darwin".equals(platform);
120+
return getPath() + (isOSX ? "/Contents/Home" : "") + "/bin/java";
119121
}
120122
};
121123
}

0 commit comments

Comments
 (0)