[ 
https://issues.apache.org/jira/browse/CB-5422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13834608#comment-13834608
 ] 

Bart van Velden edited comment on CB-5422 at 11/28/13 8:43 AM:
---------------------------------------------------------------

Had this issue on the Mac. Since java is configured just fine, this is cordova 
specific.
Fixed it on the Mac by commenting out some lines in check_req.js which is part 
of cordova. In my setup this file is located here: 
/Users/bart/.cordova/lib/android/cordova/3.2.0/bin/lib

// Returns a promise.
module.exports.check_java = function() {
    //if(process.env.JAVA_HOME) {
        var d = Q.defer();
        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));
            else d.resolve();
        });
        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.'));
    //}
}

Fixed a similar issue on Windows 8.1 in cordova last week by commenting out 
similar lines (61 to 64) in create.js , located here in my setup: 
C:\Users\Bart\AppData\Roaming\npm\node_modules\cordova\src\create.js"


was (Author: bartvanvelden):
Had this issue on the Mac. Since java is configured just fine, this is cordova 
specific.
Fixed it on the Mac by commenting out some lines in check_req.js which is part 
of cordova. In my setup this file is located here: 
/Users/bart/.cordova/lib/android/cordova/3.2.0/bin/lib

// Returns a promise.
module.exports.check_java = function() {
    //if(process.env.JAVA_HOME) {
        var d = Q.defer();
        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));
            else d.resolve();
        });
        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.'));
    //}
}

Fixed a similar issue on Windows 8.1 in cordova last week by commenting out 
similar lines (61 to 64) in create.js

> platform add android fails on Mac with JAVA_HOME error
> ------------------------------------------------------
>
>                 Key: CB-5422
>                 URL: https://issues.apache.org/jira/browse/CB-5422
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, CLI
>    Affects Versions: 3.2.0
>         Environment: Mac OS 10.9
>            Reporter: David Pfahler
>            Assignee: Mark Koudritsky
>
> Just installed 3.2.0-rc1 as announced on cordova.apache.org.
> ```
> $ cordova -v
> 3.2.0-rc.1
> ```
> When trying to update the platforms it failed, so I tried removing each 
> platform and adding again. Works for iOS. When running `sudo cordova platform 
> add android -d` I get:
> ```
> Running bin/create for platform "android" with command: 
> ""/Users/djpfahler/.cordova/lib/android/cordova/3.2.0-rc1/bin/create"  
> "/Users/djpfahler/localhost/LeadTracker/cordova/platforms/android" 
> "com.dockmaster.leadtracker" "LeadTracker"" (output to follow)
> Error: An error occured during creation of android sub-project. 
> [Error: ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and 
> JRE for java.]
>     at 
> /Users/djpfahler/.nvm/v0.10.21/lib/node_modules/cordova/src/platform.js:246:30
>     at ChildProcess.exithandler (child_process.js:641:7)
>     at ChildProcess.EventEmitter.emit (events.js:98:17)
>     at maybeClose (child_process.js:735:16)
>     at Process.ChildProcess._handle.onexit (child_process.js:802:5)
> ```
> To verify I have JAVA_HOME set correctly:
> ```
> $ echo $JAVA_HOME
> /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
> ```
> Ant is in my path:
> ```
> $ ant -v
> Apache Ant(TM) version 1.9.2 compiled on July 8 2013
> Trying the default build file: build.xml
> Buildfile: build.xml does not exist!
> Build failed
> ```
> ADT is installed.
> What happens here?



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to