versions fixed java macos

This commit is contained in:
Sebastian Hildebrandt 2019-05-30 20:12:28 +02:00
parent ed2e321487
commit fbf363b822

View File

@ -587,7 +587,23 @@ function versions(callback) {
functionProcessed();
});
if (_darwin) {
functionProcessed();
// check if any JVM is installed but avoid dialog box that Java needs to be installed
exec('/usr/libexec/java_home -V 2>&1', function (error, stdout) {
const output = stdout.toString().toLowerCase();
if (output.indexOf('no java runtime') === -1) {
// now this can be done savely
exec('java -version 2>&1', function (error, stdout) {
if (!error) {
const java = stdout.toString().split('\n')[0] || '';
const parts = java.split('"');
result.java = parts.length === 3 ? parts[1].trim() : '';
}
functionProcessed();
});
} else {
functionProcessed();
}
})
} else {
exec('java -version 2>&1', function (error, stdout) {
if (!error) {