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

前端 未结 9 2177
清歌不尽
清歌不尽 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
    

提交回复
热议问题