I get this error message when running the end step for a manual build (the begin step works fine): 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
sonarqube-9.8.0.63668
sonar-scanner-msbuild-5.10.0.59947-net46
java-version:
openjdk version “11.0.18” 2023-01-17
OpenJDK Runtime Environment Temurin-11.0.18+10 (build 11.0.18+10)
OpenJDK 64-Bit Server VM Temurin-11.0.18+10 (build 11.0.18+10, mixed mode)
JAVA_HOME variable environment is set
I’ve run out of ideas how to fix this, any help would be appreciated.
It looks like somehow your end step is running with a different version of Java than your begin step (this message is Java’s painfully obscure way of telling you there’s a version mismatch between compilation & execution).
How are you running analysis? Is this e.g. with ADO? Jenkins? Something else?
HI, I’ve solved it. For future reference: we use a command line task in ADO for the SonarScanner.MSBuild.exe begin/end commands. The build agent is running under a service account, which apparently has no environment variables (PATH and JAVA_HOME required), so I’ve set the environment variables in the command line task properties.