Cordova平台补充:无法运行'java -version'

时间:2014-08-12 16:22:30

标签: windows cordova ant

我有下一个问题:

当我跑步时,第一次cordova platform add android会产生跟随错误

Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path.

我安装了ant并添加到我的路径中

第二次运行cordova platform add android时,它说:

Error: Failed to run 'java -version', make sure your java environment is set up
including JDK and JRE.
Your JAVA_HOME variable is C:\Program Files\Java\jdk1.7.0_67
Error: Command failed: Access denied.

我添加了%JAVA_HOME%

我使用的是Windows 8。

有任何建议吗?


更多信息......

`C:\temp\siete>cordova platform add android
Creating android project...

C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path.
    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js:47:27
    at ChildProcess.exithandler (child_process.js:652:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Error: C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)`
`C:\temp\siete>cordova platform add android
Creating android project...

C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: Failed to run 'java -version', make sure your java environment is set upincluding JDK and JRE.
Your JAVA_HOME variable is C:\Program Files\Java\jdk1.7.0_67
Error: Command failed: Acceso denegado.

    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js:62:22
    at ChildProcess.exithandler (child_process.js:652:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Error: C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)`

2 个答案:

答案 0 :(得分:0)

也许你需要JDK 1.6 Java 32位。 你会说西班牙语吗? - 看一下这个链接:

http://www.phonegapspain.com/tutorial/como-instalar-phonegap-en-windows-7-paso-a-paso/

Gretings!

答案 1 :(得分:0)

您需要将%JAVA_HOME%\ bin添加到PATH变量。

命令shell只能看到%PATH%目录中的内容。