.net.net-coresonarqubesonarscannerdotnet-tool

Calling the SonarScanner CLI., Could not find 'java' executable in JAVA_HOME or PATH. for DotNet


I am trying to run sonarqube from docker on linux agent.

  1. install dotnet scanner

    dotnet tool install --global dotnet-sonarscanner --version 5.6.0

dotnet sonarscanner begin and dotnet build commands are running fine. but for dotnet sonarscanner end /d:sonar.login=$Token command, it gives error as "

**Calling the SonarScanner CLI...
16:09:31   Could not find 'java' executable in JAVA_HOME or PATH.
16:09:32   Process exited with code 1**

I tried setting JAVA_HOME also ( with and without bin in path), but it didn't work.

export JAVA_HOME=/usr/lib/jvm/jre-openjdk
export PATH="$JAVA_HOME/bin:${PATH}"
export PATH="$PATH:/root/.dotnet/tools"
echo $PATH


ls -lrt /root/.dotnet/tools/
-rwxr-xr-x 1 root root 142840 Jun 14 11:27 /root/.dotnet/tools/dotnet-sonarscanner

I read in posts to change the permission of jre in sonar, but I used "dotnet tool install --global dotnet-sonarscanner --version 5.6.0" to install sonarscanner, so don't know which location I should go and change the permissions.


Solution

  • You might need to apt-get install a Java run time/JDK.

    referencing

    https://community.sonarsource.com/t/net-gitlab-setup/40134/3