Ionic Build无法在JAVA_HOME中找到JDK集,即使它是唯一的Java安装 [英] Ionic Build can't find JDK set in JAVA_HOME even though it is the only Java install

查看:778
本文介绍了Ionic Build无法在JAVA_HOME中找到JDK集,即使它是唯一的Java安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我安装Java JDK 1.8.x时,它最初工作正常,当我在关闭过夜后第二天重新启动时,我在构建时得到了这个:

When I installed Java JDK 1.8.x it initially was working, when I rebooted the next day after shutting down over night I get this when I build:

$ ionic build android
Updated the hooks directory to have execute permissions
Running command: d:\installs\nodejs\node.exe d:\htdocs\publicworks\mobile\hooks\after_prepare\010_add_platform_class.js d:/htdocs/publicworks/mobile
add to body class: platform-android
Running command: d:\htdocs\publicworks\mobile\platforms\android\cordova\build.bat
ANDROID_HOME=c:\Users\mtpultz\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45\bin
Running: d:\htdocs\publicworks\mobile\platforms\android\gradlew cdvBuildDebug -b d:\htdocs\publicworks\mobile\platforms\android\build.gradle -Dorg.gradle.daemon=true

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_45\bin

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

d:\htdocs\publicworks\mobile\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "d:\htdocs\publicworks\mobile\platforms\android\gradlew cdvBuildDebug -b d:\htdocs\publicworks\mobile\platforms\android\build.gradle -Dorg.gradle.daemon=true"

但是Java绝对安装在这个目录中而且没有其他地方???在我的终端:

But Java is most definitely installed in this directory and nowhere else??? In my terminal:

java -version

为我的JDK生成正确的输出:

Produces the proper output for my JDK:

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

环境变量设置为:

JAVA_HOME =

JAVA_HOME =

C:\Program Files\Java\jdk1.8.0_45\bin

并且路径包含:

D:\installs\nodejs;
C:\Users\mtpultz\AppData\Roaming\npm;
D:\installs\apache-ant\bin;
C:\Users\mtpultz\AppData\Local\Android\android-sdk\tools;
C:\Users\mtpultz\AppData\Local\Android\android-sdk\platform-tools;

有什么建议吗?

推荐答案

JAVA_HOME 应该设置为java的主目录而不是bin。所以替换这个:

JAVA_HOME should be set to the home directory of java and not to bin. So replace this:

C:\Program Files\Java\jdk1.8.0_45\bin

with

C:\Program Files\Java\jdk1.8.0_45

java / bin 将dir添加到 PATH 系统变量以从任何地方运行java。

java/bin dir is added to PATH system variable to run java from anywhere.

这篇关于Ionic Build无法在JAVA_HOME中找到JDK集,即使它是唯一的Java安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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