简体   繁体   中英

"Couldn't start client Language Support For Java" error in VS Code when opening a folder in wsl

When I open a java project located in my wsl in Visual Studio Code, I get the error "Couldn't start client Language Support For Java". I have tried setting the JAVA_HOME environmental variable in wsl. Currently is is set to /mnt/c/path/to/parentfolder/jdk-18.0.1. I also set JAVA_HOME to the same directory in Windows, and VSCode is able to find it properly there. I also tried cleaning the java language server workspace. What should I try next?

Edit: I was mistaken that it's caused by wsl in general. It appears to be linked to a particular project in my wsl and other projects are working.

It turns out that the difference in behavior between the two projects was in how I was accessing the folder. I have my wsl mounted as a network drive, and opening Z:\etc on VS Code works. Opening \wsl$\etc or opening a folder by invoking code from the command line does not work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM