Home > database >  Cannot find the java excutable
Cannot find the java excutable

Time:10-29

I'm trying to run my project using gradlew.bat on cmd.

I'm using jdk-17.0.1, but my project doesn't run showing

"The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-16.0.2\bin\java.exe"

enter image description here

you can press "Enter" to open the system properties:

enter image description here

Click on Environment Variables… and the following window opens:

enter image description here

you should make the following settings:


  1. The top list ("User variables") should not contain any Java-related entries.

  2. The lower list ("System variables") should contain an entry JAVA_HOME = C:\Program Files\Java\jdk-17. If this entry does not exist, you can add it with New…. If it exists but points to another directory, you can change it with Edit….

  3. Delete the following entries under Path:

    • C:\ProgramData\Oracle\Java\javapath
    • C:\Program Files (x86)\Common Files\Oracle\Java\javapath
  4. Insert the following entry instead:

    • %JAVA_HOME%\bin

Add the Script Directory to the Path :

enter image description here

  • Related