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"
you can press "Enter" to open the system properties:
Click on Environment Variables…
and the following window opens:
you should make the following settings:
The top list (
"User variables"
) should not contain any Java-related entries.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 withNew….
If it exists but points to another directory, you can change it withEdit….
Delete the following entries under
Path:
C:\ProgramData\Oracle\Java\javapath
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
Insert the following entry instead:
%JAVA_HOME%\bin