Fix bug in detecting use of bundled JDK on macOS
This commit fixes a bug in detecting the use of the bundled JDK on macOS. This bug arose because the path of Java home is different on macOS.
This commit is contained in:
parent
567e8f8b63
commit
cebe509460
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.elasticsearch.monitor.jvm;
|
||||
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.Booleans;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
|
@ -171,8 +172,12 @@ public class JvmInfo implements Writeable, ToXContentFragment {
|
|||
*/
|
||||
final String javaHome = System.getProperty("java.home");
|
||||
final String userDir = System.getProperty("user.dir");
|
||||
if (Constants.MAC_OS_X) {
|
||||
return PathUtils.get(javaHome).equals(PathUtils.get(userDir).resolve("jdk/Contents/Home").toAbsolutePath());
|
||||
} else {
|
||||
return PathUtils.get(javaHome).equals(PathUtils.get(userDir).resolve("jdk").toAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
public static JvmInfo jvmInfo() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
|
|
Loading…
Reference in New Issue