使用cordova时出现JAVA_HOME错误

时间:2022-11-18 19:59:10

hey i am trying to run cordova run android and got this error :

嘿我想尝试运行cordova运行android并得到此错误:

ANDROID_HOME=/home/ronin/Android
JAVA_HOME=/home/ronin/jdk1.8.0_161/
(node:7717) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater
    at /home/ronin/Downloads/SyncApp/platforms/android/cordova/lib/check_reqs.js:367:19
    at _fulfilled (/home/ronin/Downloads/SyncApp/platforms/android/cordova/node_modules/q/q.js:854:54)

clearly my JAVA_HOME variable is correctly set ( i get the same error without / in the end); i am running Arch Linux and i know it uses, bu default, the openjdk versions. is that the source of the error cause this is what i get when i run java -version

很明显我的JAVA_HOME变量设置正确(我得到相同的错误,没有/到最后);我正在运行Arch Linux,我知道它使用open默认的openjdk版本。是错误的来源导致这是我运行java -version时得到的

openjdk version "9.0.4"
OpenJDK Runtime Environment (build 9.0.4+11)
OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)

help !

1 个解决方案

#1


1  

you need to uninstall OpenJDK 9.x.x and install Java SE Development Kit 8 for build ionic app in android or ios and then set JAVA_HOME path.

你需要卸载OpenJDK 9.x.x并在android或ios中安装Java SE Development Kit 8 for build ionic app,然后设置JAVA_HOME路径。

#1


1  

you need to uninstall OpenJDK 9.x.x and install Java SE Development Kit 8 for build ionic app in android or ios and then set JAVA_HOME path.

你需要卸载OpenJDK 9.x.x并在android或ios中安装Java SE Development Kit 8 for build ionic app,然后设置JAVA_HOME路径。