JAVA_HOME is set to an invalid directory:

前端 未结 15 2102
梦毁少年i
梦毁少年i 2020-12-01 04:06

I have set JAVA_HOME in my system C:\\Program Files\\Java\\jdk1.8.0_ 131\\bin; and I am trying to run cordova command( cordova build ) on command p

相关标签:
15条回答
  • 2020-12-01 04:27

    I found this while googling the issue with android licences when installing Flutter.

    For Linux, update Your ~/.bashrc (or other shell config) file by adding this line at the end:

    JAVA_HOME=/usr/local/android-studio/jre
    

    Note: I installed Android studio by following the official installation guide for Linux (link).

    For Windows, use the android studio's path to the jre directory and update the environment variable with the right value.

    Then, run flutter doctor --android-licenses and press y to review the licences which are not accepted. Press y for each of the licences. It will ask Accept? (y/N): at the end of the license file. After You accept all unaccepted licences, You should see:

    All SDK package licenses accepted
    
    0 讨论(0)
  • 2020-12-01 04:33

    JAVA_HOME should point to the home jdk directory, and not to jdk/bin directory.

    You need to set the JAVA_HOME like this:

    JAVA_HOME="C:\Program Files\Java\jdk1.8.0_131"
    
    0 讨论(0)
  • 2020-12-01 04:33

    I am using using Ubuntu.

    Problem for me solved by using sudo in terminal with the command.

    0 讨论(0)
  • 2020-12-01 04:36

    Try the following:

    • Remove \bin from JAVA_HOME path.
    • Open new command line window.
    • Run your command as an administrator.
    0 讨论(0)
  • 2020-12-01 04:40

    After setting the JAVA_HOME variable, run android studio as administrator

    0 讨论(0)
  • 2020-12-01 04:41

    On Window 10, the problem was with the semicolon ;.

    Go to edit the system environment variables and delete the semicolon at the end of JAVA_HOME value C:\Program Files\Java\jdk1.8.0_144

    In other words, convert this C:\Program Files\Java\jdk1.8.0_12; to C:\Program Files\Java\jdk1.8.0_12

    You might have to delete your entry in the Windows Dialog and create a new one. If you ever had multiple entries and get the bigger Form view, Windows automatically inserts a ; at the end of each entry, even if you only have one entry left.

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