Sonarscanner for .NET core does not find JAVA

I have problems to get the sonarscaner for .NET Core running on our build server.

The build server (Bamboo), the SonarQube server, and the sonarscanner are running on the same server. On the server two Java versions are installed:

  • jre-8u202-windows-x64 (used by Bamboo)
  • OpenJDK11U-jdk_x64_windows_hotspot_11.0.12_7 (used by SonarQube server)

The standard sonarscanner works without problems. The “dotnet tool” version of sonarscanner reports an invalid Java version:

java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0|

If I set JAVA_HOME to point to the “11.0.12_7” version, I get this error message:

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

But the path is correct. Both Java installations are in the PATH env. variable. JAVA_HOME is not set by default.

Hi @budde

You need to add a “java” capability to your build agent, having the bin path to your java.exe

HTH,
Mickaël