Reactnative $ JAVA_HOME路径错误

时间:2017-05-24 16:04:43

标签: android react-native java-home

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

在我运行“react-native run-android”命令之后,任何人都可以知道问题是什么。我在/ etc / environment中更改了我的JAVA_HOME路径,它仍然失败。

1 个答案:

答案 0 :(得分:1)

你需要指向一个jdk,目前你指向一个JVM。转到here并下载相应的jdk并安装它。然后将JAVA_HOME变量切换到jdk的新路径。