React Native: JAVA_HOME is not set and no 'java' command could be found in your PATH

前端 未结 9 2009
清歌不尽
清歌不尽 2020-12-23 16:44

I\'ve followed step by step the official Getting Started. I started from a clean linux install and installed everything required as per the \"Building Projects with Native C

相关标签:
9条回答
  • 2020-12-23 16:46
    1. Make sure you have java installed
    2. your path is wrong

    do this:

        export | grep JAVA
    

    THE RESULT: what java home is set to

    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
    
    1. follow the path to see if the directories are correct

    i did this in my terminal:

    open /Library
    

    then i went to /Java/JavaVirturalMachines turns out I had the wrong "jdk1.8.0_202.jdk" folder, there was another number... 4. you can use this command to set java_home

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
    
    0 讨论(0)
  • 2020-12-23 16:51

    I fixed this issue by installing jre, I have jdk already installed but jre was not installed.

    0 讨论(0)
  • 2020-12-23 16:53

    Please add the JAVA_HOME in the System variable no in the user variable

    1. Create the Variable name as JAVA_HOME
    2. Please use these format in the value box --> C:\Program Files\Java\jdk(version) what you have or downloaded.
    0 讨论(0)
  • 2020-12-23 17:04

    I think the right way to find the internal Java used by the Android Studio is to

    1. Open Android Studio
    2. Go to File->Other Settings->Default Project Structure/JDK Location:
    3. and copy what ever string is specified there

    This will not require memorising the folder or searching for java and also these steps wil take of any future changes to the java location by the Android Studio team changes I suppose

    0 讨论(0)
  • 2020-12-23 17:04

    It is located on the Android Studio folder itself, on where you installed it.

    0 讨论(0)
  • 2020-12-23 17:09

    All I did is go to my project directory from the cmd (command prompt) I typed java -version.it told me what version it was looking for. so I Installed that version and I changed the path to were the jdk of that version was located .

    0 讨论(0)
提交回复
热议问题