[GitHub Actions] Java version error

I get this error when I try to run SonarCloud.

The version of Java (1.8.0_275) you have used to run this analysis is deprecated and we stopped accepting it for newly created projects.

The implementation code is verbatim the one SonarCloud gives when setting up a project.

Upper in the log for the step, I see this:

INFO: Project root configuration file: D:\a\Bogus\Bogus\.sonarqube\out\sonar- 
INFO: SonarScanner
INFO: Java 1.8.0_275 AdoptOpenJDK (64-bit)
INFO: Windows Server 2019 10.0 amd64

Where does that error come from ?
Where does “Java 1.8.0_275 AdoptOpenJDK (64-bit)” come from ?
Do I have control over it, so I can reference a newer version of OpenJDK, through the step or otherwise ?
If I globally install the latest Java version inside the runner, before this SonarCloud step is executed, would it use that Java version instead of the problematic “Java 1.8.0_275 AdoptOpenJDK (64-bit)”

Hey there.

Are you following this tutorial?

I noticed for the other categories (Maven, Gradle, .NET) we explicitly ask to setup Java 11 with this step.

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

But we don’t have it listed for Other, even though it uses the same runs-on as Maven and Gradle (ubuntu-latest) :thinking:

Can you confirm this is the tutorial you’re following, and if so add this step after your Git checkout to see if that causes the issue to go away?

1 Like

Yes, thank you, this solved the error!

I was actually using an older version of the sample code, now I see it has been updated with the explicit JDK inclusion.

Without explicitly setuping Java, where does SonarCloud take the Java 1.8.0_275 from ? Might that instance of Java come preinstalled on the GitHub Actions runner ?

Okay, so I’m guessing you weren’t using the Other option. I’ll follow up on that on my own! Which option were you using the (old) version of?

Oh, sorry, forgot to include that. I was using the .NET option.

I understand Java 8 to be the default for the windows-latest image for GitHub.

1 Like