I have set up a sonar scanner MSBuild in Jenkins, but suddenly I'm getting below error.

ERROR: JAVA_HOME exists but does not point to a valid Java home
       folder. No "\bin\java.exe" file can be found there.

Below is Environment variable for Java Jdk

JAVA_HOME=C:\Program Files\Java\jdk-12.0.2

How to solve this Issue?

  • More Information: I am getting this error only for Sonar Scanner for MsBuild - End Analysis task only in Jenkins. Nov 4, 2019 at 10:50

2 Answers 2


I have added "C:\Program Files\Java\jdk-12.0.2" as value of JAVA_HOME environment Variable and its working. I don't know exactly this is the correct solution OR Not, but when I have checked sonar-scanner.bat file then it's taking %JAVA_HOME%/bin/java.exe location of Java.


Check if there is a file at C:\Program Files\Java\jdk-12.0.2\bin\java.exe.

If yes then I'd wager there is quoting issue in the SonarQube or the MSBuild task that does not like the space in the path.
Install your java in a path without a space that will likely help

If No, well... you just found your problem !

  • Yes "C:\Program Files\Java\jdk-12.0.2\bin\java.exe." exist. A few days back it was working fine, suddenly I am getting this error. Nov 4, 2019 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.