J AVA_HOME exists but does not point to a valid Java home folder

From jenkins/ command prompt,
On running
dotnet end /d:sonar.login=“”

ERROR: JAVA_HOME exists but does not point to a valid Java home
folder. No “\bin\java.exe” file can be found there.
However, JAVA_HOME path is set in environment variables.

  • SonarQube installed version is 9.8(Community edition)
  • Java installed version 17
  • Scanner Plugin SonarScanner 5.9.2 .net 5.0+
  • I wanted to do Analysis using sonarscanner for .net Project.
  • I have tried changing Path in Environment variables till ex: \bin\java.exe, \bin, path before bin folder. But its throwing same error in all cases.

Hey there.

Do you know the full path to the java.exe executable that is installed, and can you share it here?

java.exe is at this location => C:\Program files\Java\jdk-17\java.exe
And JAVA_HOME environment varible is set with value C:\Program files\Java\jdk-17\bin\java.exe.

I tried to change JAVA_HOME to C:\Program files\Java\jdk-17 but same error is getting.

Thanks. To be clear, you should target this value: C:\Program files\Java\jdk-17

Directly before running the Scanner (in the same command window), what is the output of echo %JAVA_HOME%? Is it the same value that you set?