Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Sonarqube Plugin: JAVA_HOME exists but does not point to a valid Java home

Tags:

I am trying to set up the Sonarqube for my project, but when I start to generate a build, I get the following error:

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

The SonarQube Scanner did not complete successfully

I check some docs but none of them helps. For the JAVA_HOME environment variable, I point it to be C:\Program Files (x86)\Java\jdk1.8.0_111 I also double check it by using powershell java -version command. It also gives me the same answer: java version "1.8.0_111" . Anyone knows how to solve the problem?

Thanks.

like image 634
Terry Zhang Avatar asked Dec 16 '16 20:12

Terry Zhang


2 Answers

You can edit:

C:\Users\HOME_FOLDER\.jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\SonarQubeScanner\bin>notepad sonar-scanner.bat

and put following:

SET JAVA_HOME=< JDK Path>

like image 109
jeff porter Avatar answered Sep 25 '22 16:09

jeff porter


if EXIST in the sonar-scanner.bat fails because there is a space in the path, so the solution is to set the JAVA_HOME to a value without spaces e.g. using the short name of the "Program Files" SET JAVA_HOME= C:\Progra~1\Java\jre9

like image 37
Elviss Strazdins Avatar answered Sep 25 '22 16:09

Elviss Strazdins