none
“Failed to run 'java -version...'” exception occured when run appache cordova project

    Question

  • Hi All,

    I am new in developing cordova app, I installed vs2013 and multi-device hybrid app for visual studio 2013 - ctp2.

    I create a new project "Blank App (Apache Cordova)",  and I try to run the sample project. The error as follow:

     "Failed to run 'java -version', make sure your java environment is set up"

    "Command failed: Error: could not open `C:\Program Files (x86)\Java\jre6\lib\i386\jvm.cfg'"

    "C:\Users\Hugo\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8"

    ....

    It seems like the JAVA_HOME was not configure correctly. But I have check my PC's environment variable, the JAVA_HOME has configured correctly and I can run 'java -version' in cmd.

    I have installed jdk 1.6 in "C:\Program Files (x86)\Java\" once but I have upgrade to 1.7 for a long time. Now the jdk 1.7 installed in "C:\Program Files\Java\jdk1.7.0_71". I can check the JAVA_HOME in vs2013 was correct.

    Why vs2013 still find the old installation path(C:\Program Files (x86)\Java\jre6\lib\i386\jvm.cfg') of java? 

    Here are some output when I run the program:

    1>EXEC : error : Failed to run 'java -version', make sure your java environment is set up
    1>  including JDK and JRE.
    1>  Your JAVA_HOME variable is C:\Program Files\Java\jdk1.7.0_71
    1>EXEC : error : Command failed: Error: could not open `C:\Program Files (x86)\Java\jre6\lib\i386\jvm.cfg'
    1>  
    1>  
    1>      at C:\Users\Hugo\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js:62:22
    1>      at ChildProcess.exithandler (child_process.js:641:7)
    1>      at ChildProcess.EventEmitter.emit (events.js:98:17)
    1>      at maybeClose (child_process.js:743:16)
    1>      at Socket.<anonymous> (child_process.js:956:11)
    1>      at Socket.EventEmitter.emit (events.js:95:17)
    1>      at Pipe.close (net.js:465:12)
    1>  Command finished with error code 8: C:\Users\Hugo\.cordova\lib\android\cordova\3.5.0\bin\create.bat --cli,f:\VS2013\BlankCordovaApp1\BlankCordovaApp1\bld\Debug\platforms\android,io.cordova.BlankCordovaApp1,BlankCordovaApp1
    1>  
    1>  C:\Users\Hugo\AppData\Roaming\npm\node_modules\vs-mda\node_modules\q\q.js:126
    1>                      throw e;
    1>                            ^
    1>EXEC : error : C:\Users\Hugo\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8
    1>      at ChildProcess.whenDone (C:\Users\Hugo\AppData\Roaming\npm\node_modules\vs-mda\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
    1>      at ChildProcess.EventEmitter.emit (events.js:98:17)
    1>      at maybeClose (child_process.js:743:16)
    1>      at Process.ChildProcess._handle.onexit (child_process.js:810:5)

    How can I fix the problem?

    Thanks a lot!

    Thursday, October 30, 2014 1:15 PM

Answers

All replies

  • Hi HugoZheng,

    Thank you for visiting the MSDN forum. I’m afraid that it is not the correct forum about this issue, since this forum is to discuss and ask questions about the install and setup of Visual Studio. I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum. Thanks for your understanding.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 31, 2014 4:01 AM
  • I'd try them over here.

    http://stackoverflow.com/questions/tagged/multi-device-hybrid-apps

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Friday, October 31, 2014 2:55 PM
    Moderator
  • Thanks for you help! But I have fixed it by re-install node.js.
    Saturday, November 1, 2014 6:11 PM
  • Sounds good, you're welcome.

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Saturday, November 1, 2014 6:29 PM
    Moderator