简体   繁体   English

离子构建失败:JAVA_HOME无效

[英]Ionic Build Failed: JAVA_HOME is invalid

I wanted to start my first build with ionic. 我想从离子开始我的第一个版本。 But the Build fails very soon with the following error: 但是构建很快就会失败,并出现以下错误:

Running command: E:\Apps\ASV\Node\node.exe E:\Apps\ASV\Code\MyASV\hooks\after_prepare\010_add_platform_class.js E:\Apps\ASV\Code\MyASV
add to body class: platform-android
Error: Failed to run "java -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: C:\Program Files\java\jdk1.8.0_77

I tried several things over the past hour to fix this. 在过去的一个小时里,我尝试了几种方法来解决此问题。 I deinstalled all Java related stuff, reinstalled it, set the JAVA_HOME several times to the jdk path, added %JAVA_HOME%\\bin to the path-variable, but nothing fixed it. 我卸载了所有与Java相关的东西,重新安装了它,将JAVA_HOME设置为jdk路径几次,将%JAVA_HOME%\\ bin添加到路径变量,但没有任何方法可以解决。 Currently my JAVA_HOME, which i had to create manually, looks like this at the moment: 目前,我必须手动创建的JAVA_HOME如下所示:

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

Please note that this path is different to the one in the error message. 请注意,此路径与错误消息中的路径不同。 The 'Java' is written in lowercase and in uppercase, I don't know if this is relevant. “ Java”以小写和大写形式编写,我不知道这是否相关。 Also changing this JAVA_HOME variable and then trying a rebuild gives the same error, the changed variable seems to have no effect on the one ionic uses. 同样,更改此JAVA_HOME变量,然后尝试重建也会产生相同的错误,更改后的变量似乎对一种离子用途没有影响。

How can I fix this? 我怎样才能解决这个问题? What exactly is going wrong? 到底出了什么问题?

Okay, i fixed it. 好吧,我修好了。 The Error 错误

Your JAVA_HOME is invalid: C:\Program Files\java\jdk1.7.0_79

Is quite irritating. 相当烦人。 The error was that the PATH-variable missed an entry like 错误是PATH变量错过了像这样的条目

C:\Program Files\Java\jdk1.7.0_79\bin

Somehow 不知何故

%JAVA_HOME%\bin

still causes the error. 仍然会导致错误。

您将需要编辑框的环境变量,以将JAVA_HOME指向当前的jdk bin /目录

it should be pointing to JDK\\bin folder , usually C:\\ProgramFiles\\Java\\jdk*\\bin directory. 它应该指向JDK \\ bin文件夹,通常是C:\\ ProgramFiles \\ Java \\ jdk * \\ bin目录。

I recently tried in my new windows PC and gone through same issue. 我最近在新的Windows PC中尝试过,并遇到了同样的问题。

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

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