Documantation on java JRE/JDK installation misleading

Please provide

  • Operating system:Lin
  • IDE name and flavor/env: VSCode
  • SonarLint plugin version: v3.5.3
  • Is connected mode used: unrelated

And a thorough description of the problem / question:

The documentations says you need JRE

However, it also states you need javac, but javac is in JDK and not JRE!

e.g. Debian:

Hey there.

You’ll notice that javac is not used directly, but simply as another way to potentially find a JRE (since a JDK is a superset of JRE). So you still don’t need a JDK, but if you have one installed and SonarLint can discover it, it will try and find the associated runtime based on that discovery.

But SonarLint cannot discover a JRE installation. I would have to configure 1,2 or 3 to find it :confused:

At least this is what happened in my devcontainer.

Hello @KUGA2,

Do you mean that SonarLint for VSCode does not behave as expected ? Are you in a case that is documented and should your Java installation be automatically detected ?

As a side note, we are working on embedding a small JRE in the extension so that users don’t have to worry about it, it should work out of the box. This change is supposed to come soon, see this ticket.

I am not sure what you mean…

The reproduction is (I have not tried this exactly we have way more infrastucture… e.g. wsl):

  1. Have linux with docker and vscode
  2. create new project
  3. Install remote containers extension
  4. Add basic devcontainer,json file (e.g. with debian image)
  5. Reopen project in a container
  6. install jre (in container, e.g apt install openjdk-17-jre-headless)
  7. Install SonarLint extension (in container)
    → Message JRE not found will appear.

Is this not a valid use case?

Given your setup, and given the current detection algorithm in SonarLint VSCode, I think indeed you will have to use option 1 or 2 or 3 to help SonarLint detect the JRE.

There are probably solutions we could use to improve our detection algorithm for the JRE to be automatically picked, as mentioned earlier we plan to embed the JRE which will simplify the configuration even more.

Hope this helped

1 Like

Thanks. In the meantime I will just install JDK which is easier for now :slight_smile:

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