If you don’t have anything explicitly configured, the extension will use a heuristic provided by the find-java-home NPM package to try to find the “right” one - and maybe it finds an older version, somehow.
In the event that it fails to find a suitable one, you can force it with the sonarlint.ls.javaHome property in your user settings.
Also, there might be additional details in the SonarLint Output (Ctrl+Shift+P, “SonarLint: Show SonarLint Output”).
The error links to the Java SDK, but the error message ask me to install a recent Java JRE.
After installing a recent Java JRE, it seems the Java JDK is actually required?
Edit: I installed the JDK jdk1.8.0_231, and updated the SonarLint Java Home.
It is still giving error messages. I see not solution but to disable the SonarLint plugin in VSCode
$ /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
$ ls
COPYRIGHT include
LICENSE javafx-src.zip
README.html jre
THIRDPARTYLICENSEREADME-JAVAFX.txt lib
THIRDPARTYLICENSEREADME.txt man
bin release
db src.zip
FWIW, I use jEnv to manage Java versions. My global JDK is set to Java 8 and my project JDK is set to Java 11 (at least for the current project). I had also previously configured VSC to use JDK 11 via the java.home key in settings.json, but this was ignored.
I suspect the find-java-home NPM package was finding JDK 8. Perhaps there is a better way to find a specific/target JDK so you can specify needing JDK 11+ instead of finding an incorrect version?
Hello Michael, welcome to the community! And thank you for your feedback.
I agree: SonarLint could be smarter that this and try to find a Java runtime that meets its needs, instead of taking the first one it detects. I created an issue to track this.