Can't run SonarLint, even with Java11

What else am I supposed to do?

Hello @SomeBodyOnTheWebs,

Could you send me the ouput of:

java -version

Please note that here the command uses a single dash. And

where java

You could also try to activate verbose logs in the plugin settings and see if you notice something interesting in the Output view ?

Brudder…did you look at my screenshot? There’s a java -version output. But again…

Temurin = adoptopenjdk https://adoptopenjdk.net / https://adoptium.net . Zulu is Java Download | Java 8, Java 11, Java 13 - Linux, Windows & macOS , depends what I need i interchange them. And jdk-11.0.14 is Oracle java jdk. Doesn’t matter which java 11 jdk I set, oracle, temurin or zulu, always same error

I did look at your screenshot, thanks for asking. You probably noticed that java -version and java --version have slightly different outputs, and as we rely on the first variant, I wanted to make sure of what you get on your box.

This thread is the occasion to improve our documentation to explain how we try to locate the Java runtime. I updated the project’s README, here is the summary:

The SonarLint language server needs a Java Runtime (JRE) 11+. If one is already installed on your computer, SonarLint should automatically find and use it. Here is how SonarLint will search for an installed JRE (in priority order):

  1. the sonarlint.ls.javaHome variable in VS Code settings if set. For instance:
    {
    “sonarlint.ls.javaHome”: “C:\Program Files\Java\jre-11.0.11”
    }
  2. the value of the JDK_HOME environment variable if set
  3. the value of the JAVA_HOME environment variable if set
  4. on windows the registry is queried
  5. if a JRE is still not found then:
    1. the PATH is scanned for javac
    2. on mac, the parent directory of javac is checked for a java_home binary. If that binary exists then it is executed and the result is used
    3. the grandparent directory of javac is used. This is similar to $(dirname $(dirname $(readlink $(which javac))))

SonarLint then uses the first JRE found in these steps to check its version.
If a suitable JRE cannot be found at those places, SonarLint will ask for your permission to download and manage its own version.

This detection algorithm is not perfect and we already have plans to improve it.

Based on your environment you should be able to tell in which situation you are. My guess is that you have an environment variable like JAVA_HOME pointing to a JRE 8 (maybe the second one in your list?).

Hope this helped
Damien

I set it to c:\\Scoop\\apps\\temurin11-jdk\\current and now it works, or I think it works. Haven’t had a code tested yet. Output says

This looks like a separate issue: the Git extension is not respecting its own API and returns an undefined value instead of an empty array for the list of detected repositories.

I created an issue to take care of this in the upcoming release.

Hello @SomeBodyOnTheWebs,

The issue has been fixed, could you please give another try and check if you can finally get your code to be analyzed ?