Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation

后端 未结 16 2183
天命终不由人
天命终不由人 2020-12-01 02:50

Even though I manually configured JDK project structure file/Project structure it still shows this error FAILURE: Build failed with an exception.

`What went wrong:

相关标签:
16条回答
  • 2020-12-01 02:55

    What I did was I uninstalled Java from my PC, and then downloaded and installed JDK again from Oracle. After this it worked perfectly. I think the problem was because the JRE and JDK update version were different from each other.

    0 讨论(0)
  • 2020-12-01 02:57

    What worked for me was updating Android Studio and updating JAVA_HOME and ANDROID_HOME environment variables. I believe it was caused due to the fact that I updated Java Version (through updater) but did not update jdk.

    0 讨论(0)
  • 2020-12-01 02:58

    What I did was download the JDK from here, start a windows command prompt (windows+r CMD) and set the environment variable JAVA_HOME to c:\Program Files\Java\jdk-14 with:

    set JAVA_HOME="c:\Program Files\Java\jdk-14"
    

    Then run what I wanted to run. It failed afterwards, but on a different issue.

    0 讨论(0)
  • 2020-12-01 03:00

    Please make sure both JDK and jre are on same version for example if you have JRE version 1.8.0_201 then JDK version should be 1.8.0_201 version.

    0 讨论(0)
  • 2020-12-01 03:01
    ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_121 contains a valid JDK installation
    

    Copy tools.jar from C:\Program Files\Java\jdk1.8.0_121\lib to C:\Program Files\Java\jre1.8\lib.

    It's resolved the problem now.

    0 讨论(0)
  • 2020-12-01 03:01

    I had the same problem and fixed it like this:

    1. Install the JDK from the Oracle website with the same version number as the JRE if you didn't already.
    2. Furthermore add JAVA_HOME to the environment variables of Windows.
    3. Restart your terminal or development environment to load the new JAVA_HOME value.

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