也许JAVA_HOME并没有指向JDK

时间:2014-12-10 11:06:52

标签: java cordova

我在制作phonegap构建期间遇到此错误

C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:601: The followin
g error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:720: The followin
g error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:734: Unable to fi
nd a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre1.8.0_25"

Total time: 45 seconds



D:\xampp\htdocs\mymind\mymind\mymind\platforms\android\cordova\node_modules\q\q.
js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,D:\xampp\htdocs\mymi
nd\mymind\mymind\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.
dir=ant-gen

我认为我已经添加到windows envirement变量的系统变量中的PATH问题。

  • JAVA_HOME - > C:\ PROGRAM 文件\爪哇\ jdk1.8.0_25; C:\ PROGRA〜2 \爪哇\ jdk1.8.0_25 \ JRE

其他错误

BUILD FAILED
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:653: The followin
g error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:698: null returne
d: 1

Total time: 14 seconds


D:\xampp\htdocs\mymind\mymind\mymind\platforms\android\cordova\node_modules\q\q.
js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,D:\xampp\htdocs\mymi
nd\mymind\mymind\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.
dir=ant-gen

Error: D:\xampp\htdocs\mymind\mymind\mymind\platforms\android\cordova\build.bat:
 Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\umar.farooq\AppData\Roaming\npm\node_modu
les\phonegap\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspaw
n.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 :(得分:3)

  

目前设置为" C:\ Program Files \ Java \ jre1.8.0_25"

jre代表Java Runtime Environment,您需要jdk这是Java Development Kit。

因此,JAVA_HOME应该指向C:\Program Files\Java\jdk1.8.0_25,并且在您的PATH系统变量中,您应该C:\Program Files\Java\jdk1.8.0_25\bin

答案 1 :(得分:0)

确保您使用的是Java SE SDK,而不是Java EE SDK,因为android无法识别第二个。