2

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.

user892077
  • 33
  • 9
  • What is your O/S? That `JAVA_HOME` doesn't look correct. – stdunbar Jun 14 '22 at 15:53
  • OS is linux server - Description: Oracle Linux Server release 7.9 – user892077 Jun 14 '22 at 15:55
  • What is in your `/usr/lib/jvm` directory? – stdunbar Jun 14 '22 at 16:02
  • lrwxrwxrwx jre-1.8.0-openjdk-1.8.x86_64 -> java-1.8.0-openjdk-1.8.x86_64/jre lrwxrwxrwx jre -> /etc/alternatives/jre lrwxrwxrwx jre-openjdk -> /etc/alternatives/jre_openjdk lrwxrwxrwx jre-1.8.0 -> /etc/alternatives/jre_1.8.0 jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk drwxr-xr-x java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64 java-1.8.0 -> /etc/alternatives/java_sdk_1.8.0 java-1.8.0-openjdk -> /etc/alternatives/java_sdk_1.8.0_openjdk java -> /etc/alternatives/java_sdk java-openjdk -> /etc/alternatives/java_sdk_openjdk java-1.6.0 -> /etc/alternatives/java_sdk_1.6.0 – user892077 Jun 14 '22 at 16:13
  • 1
    Can someone plz help me on this – user892077 Jun 15 '22 at 04:08

1 Answers1

1

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

referencing

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

Sh7ne
  • 388
  • 3
  • 8