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

CC BY-SA 4.0
2019-11-05T07:28:02.093Z
2019-11-05T07:28:02.093Z
ankit thakkar
<p>Check if there is a file at C:\Program Files\Java\jdk-12.0.2\bin\java.exe.</p>

<p>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.<br>
Install your java in a path without a space that will likely help</p>

<p>If No, well...  you just found your problem !</p>

CC BY-SA 4.0
2019-11-04T13:28:17.260Z
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.
ankit thakkar
CC BY-SA 4.0
2019-11-04T13:18:20.533Z
2019-11-04T13:18:20.533Z
Newtopian
<p>I have set up a sonar scanner MSBuild in Jenkins, but suddenly I'm getting below error.</p>

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

<p>Below is Environment variable for Java Jdk</p>

<pre><code>JAVA_HOME=C:\Program Files\Java\jdk-12.0.2
</code></pre>

<p>How to solve this Issue?</p>

CC BY-SA 4.0
2019-11-04T10:50:33.250Z
More Information: I am getting this error only for **Sonar Scanner for MsBuild - End Analysis** task only in Jenkins.
ankit thakkar
<jenkins><sonarqube>
JAVA_HOME error in Sonar Scanner for MSBuild
ankit thakkar
# JAVA_HOME error in Sonar Scanner for MSBuild

(Asked by: username_0 on 2019-11-04)

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?

**Tags:** jenkins, sonarqube

> **Comments:**
> **username_0**: More Information: I am getting this error only for **Sonar Scanner for MsBuild - End Analysis** task only in Jenkins.  

---

## 2 answers

### Answer by username_0 on 2019-11-05. Score: 1

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.


---

### Answer by username_1 on 2019-11-04. Score: 0

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 !

> **Comments:**
> **username_0**: 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.  

---

