How do I tell SonarCloud to use Java 17 rather than attempting to use Java 11 for my GitHub project?

The version of Java (11.0.3) used to run this analysis is deprecated, and SonarCloud no longer supports it. Please upgrade to Java 17 or later.

I’ve attempted to fix it by changing a part of the GitHub CI configuration file to:

      - name: Set up JDK 17
        uses: actions/setup-java@v1
          java-version: 17

However, that doesn’t seem to work. I keep getting the error message that I am supposedly using Java 11. What should I do?

EDIT: I’ve tried copying the SonarCloud CI for GitHub Actions from the documentation, one which doesn’t mention Java at all, and I am still getting the same error message: AECforWebAssembly/.github/workflows/build.yml at master · FlatAssembler/AECforWebAssembly · GitHub


Welcome to the community!

It looks like our docs have lagged behind the actual action, which is at version 2. Couldyou update to sonarsource/sonarcloud-github-c-cpp@v2 and try again?


Can you explain to me how that solution works? It’s very counter-intuitive. If the old version of SonarCloud complains that it cannot be run on Java 11 but needs to run on Java 17, how can updating to a new version of SonarCloud be a solution? The new version of SonarCloud is, if anything, less likely to run on Java 11, rather than more.


Yes, exactly. By updating the action, you got one that runs with Java 17.


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