Sonar Scanner 5.0.1 not working with java 11

  • What version are you upgrading from?

  • System information (Operating system, Java version, Database provider/version)
    RHEL 8, Java 11, MSSQL

  • What’s the issue you’re facing?
    This page shows the scanner should support Java 11:
    Prerequisites and overview

This is the version we installed:

Here is java version and error message when testing the scanner from server:
[root@devbagent061 share]# java --version
openjdk 11.0.20 2023-07-18 LTS
OpenJDK Runtime Environment (Red_Hat- (build 11.0.20+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat- (build 11.0.20+8-LTS, mixed mode, sharing)
[root@devbagent061 share]# sonar-scanner -h
Error: LinkageError occurred while loading main class org.sonarsource.scanner.cli.Main
java.lang.UnsupportedClassVersionError: org/sonarsource/scanner/cli/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Not sure what steps to take next? Any help appreciated. Thanks!


The server supports analyzing with Java 11. Unfortunately, we’ve released new scanner versions since 9.9 was released and bumped up the required version there. You can use the Show more link on the SonarScanner page to access the download for SonarScanner 4.8 if you really need to.

Or if this is a question of needing to build to a lower Java version, you can do that with Java 17, and the -target compile option.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.