mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 01:53:00 +08:00
CB-5422: Don't require JAVA_HOME to be defined
JAVA_HOME is not necessarily defined on Linux and Mac. Print out the value of JAVA_HOME in the error message in case "java -version" fails.
This commit is contained in:
parent
f1cfe2b07b
commit
2f66ec60db
@ -52,16 +52,18 @@ module.exports.check_ant = function() {
|
|||||||
|
|
||||||
// Returns a promise.
|
// Returns a promise.
|
||||||
module.exports.check_java = function() {
|
module.exports.check_java = function() {
|
||||||
if(process.env.JAVA_HOME) {
|
|
||||||
var d = Q.defer();
|
var d = Q.defer();
|
||||||
child_process.exec('java -version', function(err, stdout, stderr) {
|
child_process.exec('java -version', function(err, stdout, stderr) {
|
||||||
if(err) d.reject(new Error('ERROR : executing command \'java\', make sure you java environment is set up. Including your JDK and JRE.' + err));
|
if(err) {
|
||||||
|
var msg =
|
||||||
|
'Failed to run \'java -version\', make sure your java environment is set up\n' +
|
||||||
|
'including JDK and JRE.\n' +
|
||||||
|
'Your JAVA_HOME variable is ' + process.env.JAVA_HOME + '\n';
|
||||||
|
d.reject(new Error(msg + err));
|
||||||
|
}
|
||||||
else d.resolve();
|
else d.resolve();
|
||||||
});
|
});
|
||||||
return d.promise;
|
return d.promise;
|
||||||
} else {
|
|
||||||
return Q.reject(new Error('ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a promise.
|
// Returns a promise.
|
||||||
|
Loading…
Reference in New Issue
Block a user