PhoneGap/Cordova"javac -version"未找到. [英] PhoneGap/Cordova "javac -version" not found.

查看:54
本文介绍了PhoneGap/Cordova"javac -version"未找到.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将Mac更新为Yosimite.我还安装了JDK 1.8x.但是,当我去 phonegap运行android 时,我得到以下信息:

I've updated my Mac to Yosimite. I've also installed JDK 1.8x. However, when I go phonegap run android I get the following:

[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...

/Users/profile/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:126
                    throw e;
                          ^
Error: Failed to run "javac -version", make sure you have a Java JDK (not just a JRE) installed.
    at /Users/profile/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/lib/check_reqs.js:43:27
    at ChildProcess.exithandler (child_process.js:641:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)
{ [Error: /Users/profile/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/create: Command failed with exit code 8] code: 8 }
   [error] /Users/profile/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/create: Command failed with exit code 8

我已经设置了我的 $ JAVA_HOME ,当我执行 javac -version 时,我得到了 javac 1.8.0_25 .一切似乎都很好.

I have setup my $JAVA_HOME, and when I do javac -version I get javac 1.8.0_25. Everything seems to be fine.

我唯一能想到的就是phonegap就是在运行时更改路径

The only thing which I can think of is phonegap is changing the path at run time

推荐答案

好的,

由于某种原因,无论我给了多少鼓励,Java 1.7和1.8都不想表现出色.我要做的就是下载Java 1.6并使用它.尽管您无法从Java下载站点获得此功能,但与此相关的是.相反,您必须从Apple获得它.你可以在这里得到

So for some reason Java 1.7 and 1.8 don't want to play nice no matter how much encouragement I gave it. What I had to do is download Java 1.6 and use that. The thing with this though you can't get this from the Java Download site. Instead, you have to get it from Apple. You can get this here

http://support.apple.com/kb/DL1572

这与OSX 2013-005中包含的Java版本相同.下载后,您将拥有多个Java版本.苹果公司的Java 1.6版本与甲骨文的版本不在同一位置.苹果一键式放置在系统库中.这意味着您必须将 JAVA_HOME var更改为此系统之一.一旦完成,就完成了.

This is the same version of Java which was included in OSX 2013-005. Once you have downloaded this you will now have multiple versions of Java. The Java 1.6 version from Apple doesn't get placed in the same spot as the ones from Oracle. The Apple one get's placed in the System Library. This means you have to change the JAVA_HOME var to this system one. Once I did that it was done.

这就是我设置路径的方式:

So this is how I set my path:

export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin

我不知道为什么我无法使Java 1.7和1.8正常工作,但这是唯一为我修复的东西.

I have no idea why I couldn't get Java 1.7 and 1.8 working, but this is the only thing which fixed it for me.

这篇关于PhoneGap/Cordova"javac -version"未找到.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆