获取错误“your java\u home is invalid”在使用ionic构建时,设置了path和java\u home变量

zsohkypk  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(277)

尝试运行命令时 ionic cordova run android ,最后出现以下错误:

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Android\android-sdk (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Failed to run "javac -version", make sure that you have a JDK version 8 installed.
You can get it from the following location:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html        

Your JAVA_HOME is invalid: C:\Program Files\Java\jdk1.8.0_271
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

当我查找其他有此错误的人时,问题似乎是他们没有安装jdk或者他们的路径变量不正确。但是,我安装了正确版本的jdk,并且设置了path和javau home变量。
路径: C:\Program Files\Java\jdk1.8.0_271\bin java\u主页: C:\Program Files\Java\jdk1.8.0_271 我在以下位置安装了jdk:

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

在我看来,path和javau home变量设置正确。有人知道是什么导致了这个错误吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题