Visual Studio Code: Java Extension Pack can’t locate java sdk when started over SSH

Tags: , , , ,

I’m trying to start a JAVA program on my Raspberry 4 from my Windows laptop using a SSH Connection in Visual Studio Code. The connection works (I can see I’m on the Raspberry in the Terminal) and I installed the Java Extension Pack on the Raspberry:

VSC running on my Windows laptop accessing the Raspi with SSH

Now I would like to run the Java Project that is located on my Raspy, but when I open it, I get this error message:

error message

And when I click on “open settings”, the settings.json file located on my laptop gets opened:

"window.zoomLevel": 1,
"extensions.ignoreRecommendations": false,
"typescript.updateImportsOnFileMove.enabled": "always",
"git.enableSmartCommit": true,
"files.autoSave": "afterDelay",
"git.autofetch": true,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.semanticHighlighting.enabled": true,
"java.home": "C:/Program Files/Java/jdk-11.0.7",
"files.exclude": {
    "**/.classpath": true,
    "**/.project": true,
    "**/.settings": true,
    "**/.factorypath": true
"remote.SSH.remotePlatform": {
    "pi4": "linux",

So I tried changing “java.home”: “C:/Program Files/Java/jdk-11.0.7” to the location where java SDK 11 is saved on the raspberry. But my first problem is, I’m not sure which to use here and if that’s even the correct path to use on raspberry?:

my java sdks

And it also doesn’t work, I think I just change the settings of my windows VSC and not the settings of the remote VSC. I know this is a very specific problem, but maybe somebody had the same issue?



1.Install JDK in WSL

2.Export the path of JDK in WSL (write export JDK_HOME=/path/to/jdk/) in ~/.bashrc file and source it

3.Restart VS Code

from here

Source: stackoverflow