VSCode 1.74.3 + Remote SSH extension version 0.94.0
Fedora 37 on UTM (VM on MacOS)
OpenJDK version 11
when I open VSCode, Sonarlint extension is activated; although I’ve my Java installed and running which java produce /usr/bin/java, the extension cannot find Java in my system. Additionally when I click on “Let Sonar download the JRE” nothing happens and the output from the extension lacks error info.
Hello, welcome to the community! And thanks for reporting this.
If I understand correctly, you are using the VSCode client on macOS, connecting through SSH to a remote workspace on the Fedora VM, did I get this right?
If this is the case, a Java 11 or 17 runtime has to be available on the remote - that is, on the VM - since this is where the Language Server will run.
Also, if you want to set the JVM’s location using the sonarlint.ls.javaHome property, it has to be set in the “Remote” settings.
Hello, thanks for replying. Yes you’re correct, my VSCode is running on Mac and connecting via SSH to a VM I created.
So I installed Java on my remote, I also set the sonarlint.ls.javaHome in the correct place but this has no effect and I always get “Couldn’t start client SonarLint Language Server”.
log.ts:304 INFO [attempt 1] Invoking resolveAuthority(ssh-remote)
log.ts:316 ERR [Extension Host] (node:4613) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code Helper (Plugin) --trace-deprecation ...` to show where the warning was created)
console.ts:137 [Extension Host] (node:4613) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code Helper (Plugin) --trace-deprecation ...` to show where the warning was created)
E @ console.ts:137
log.ts:304 INFO [attempt 1] resolveAuthority(ssh-remote) returned '127.0.0.1:57965' after 905 ms
notificationsAlerts.ts:42 The Java Runtime Environment can not be located. Please install a JRE, or configure its path with the sonarlint.ls.javaHome property. You can also let SonarLint download the JRE from AdoptOpenJDK. This JRE will be used only by SonarLint.
c @ notificationsAlerts.ts:42
notificationsAlerts.ts:42 Couldn't start client SonarLint Language Server
c @ notificationsAlerts.ts:42
log.ts:304 INFO [perf] Render performance baseline is 15ms
console.ts:137 [Extension Host] rejected promise not handled within 1 second: [object Object]
E @ console.ts:137
log.ts:316 ERR The Java Runtime Environment can not be located. Please install a JRE, or configure its path with the
sonarlint.ls.javaHome property. You can also let SonarLint download the JRE from AdoptOpenJDK. This JRE will be
used only by SonarLint.
console.ts:137 [Extension Host] rejected promise not handled within 1 second: [object Object]
E @ console.ts:137
Please let me know if I can provide any other information. Could you elaborate how did you installed the extension, and java?
When you tried to set sonarlint.ls.javaHome, which value did you set it to?
As far as I can tell, if which java returns /usr/bin/java, it means that it is most probably a file system link.
In order to know the actual value to use in sonarlint.ls.javaHome, you can run the following command (on the remote): readlink -f /usr/bin/java | sed "s:bin/java::"
For reference, on my (Ubuntu) development box with OpenJDK 11, it returns /usr/lib/jvm/java-11-openjdk-amd64/.
I suppose your function readJavaConfig from requirements.ts in /src/utils (SonarLint git repo) returns a null string in my case… and I’m not sure why though…