fix: detect JAVA_HOME with Java 11 (#1406)

This commit is contained in:
Lars Mikkelsen 2022-03-17 19:38:04 -04:00 committed by GitHub
parent 6d3ce211dd
commit 112f0a61a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

3
lib/env/java.js vendored
View File

@ -99,7 +99,8 @@ const java = {
} else {
// See if we can derive it from javac's location.
var maybeJavaHome = path.dirname(path.dirname(javacPath));
if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
if (fs.existsSync(path.join(maybeJavaHome, 'bin', 'java')) ||
fs.existsSync(path.join(maybeJavaHome, 'bin', 'java.exe'))) {
environment.JAVA_HOME = maybeJavaHome;
} else {
throw new CordovaError(default_java_error_msg);