Reactnative $JAVA_HOME path error

依然范特西╮ 提交于 2019-12-11 08:26:31

问题


zzz@zzz-PC ~/AndroidStudioProjects/Example $ react-native run-android
Scanning 555 folders for symlinks in /home/zzz/AndroidStudioProjects/Example/node_modules (16ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...

ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-9-oracle

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

Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Anyone can tell what's the problem, after I've run "react-native run-android" command. I've changed my JAVA_HOME path in /etc/environment, it still failed.


回答1:


You need to be pointing to a jdk, currently you are pointing to a JVM. Go here and download the appropriate jdk and install it. Then switch your JAVA_HOME variable to the new path to the jdk.



来源:https://stackoverflow.com/questions/44163456/reactnative-java-home-path-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!