繁体   English   中英

也许JAVA_HOME没有指向JDK

[英]Perhaps JAVA_HOME does not point to the JDK

我在制作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环境变量的系统变量的PATH问题。

  • JAVA_HOME-> C:\\ Program Files \\ Java \\ jdk1.8.0_25; C:\\ Progra〜2 \\ Java \\ 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)

当前设置为“ C:\\ Program Files \\ Java \\ jre1.8.0_25”

jre代表Java Runtime Environment,您需要jdk ,它是Java开发工具包。

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM