简体   繁体   English

在 wsl 中打开文件夹时,VS Code 中出现“无法启动 Java 的客户端语言支持”错误

[英]"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".当我在 Visual Studio Code 中打开位于我的 wsl 中的 java 项目时,我收到错误“无法启动 Java 的客户端语言支持”。 I have tried setting the JAVA_HOME environmental variable in wsl.我试过在wsl中设置JAVA_HOME环境变量。 Currently is is set to /mnt/c/path/to/parentfolder/jdk-18.0.1.当前设置为 /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.我还将 JAVA_HOME 设置为 Windows 中的同一目录,并且 VSCode 能够在那里正确找到它。 I also tried cleaning the java language server workspace.我还尝试清理 java 语言服务器工作区。 What should I try next?接下来我应该尝试什么?

Edit: I was mistaken that it's caused by wsl in general.编辑:我误认为它通常是由 wsl 引起的。 It appears to be linked to a particular project in my wsl and other projects are working.它似乎与我的 wsl 中的特定项目相关联,并且其他项目正在运行。

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.我将我的 wsl 安装为网络驱动器,并在 VS Code 上打开 Z:\etc 工作。 Opening \wsl$\etc or opening a folder by invoking code from the command line does not work.通过从命令行调用代码打开 \wsl$\etc 或打开文件夹不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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