[求助] IDEA 2022.3 连接 WSL2 无法运行 Java 代码

2022-12-05 21:42:20 +08:00
 Richardhtw

打开 IDEA ,点击 Remote Development -> WSL ,然后依次选择 IDE 版本和项目目录。打开之后编写代码并点击运行,运行失败报错:

java: Cannot run program "/usr/lib/jvm/jdk8u352/bin/java" (in directory "/home/XXXX/.cache/JetBrains/RemoteDev-IU/_home_XXXX_Projects_demo/compile-server"): error=0, Failed to exec spawn helper: pid: 2483, exit value: 1

有人遇到相似的错误吗?

1712 次点击
所在节点    JetBrains
4 条回复
house600
2023-01-10 14:52:44 +08:00
我也遇到了,有解吗
Richardhtw
2023-01-10 22:52:52 +08:00
house600
2023-01-11 09:48:26 +08:00
@Richardhtw 我也看到了,加上了 JVM 参数还是不行
Dxxxxs
2023-02-11 23:26:58 +08:00
@house600 按照最下面那哥们的方法试了一下 解决了。
I have the same issue using Windows 10 as my local machine and a Linux remote server. Locally I have Gateway 2022.3.1 installed and on the remote I've tried with both 2022.3.1 and the 2022.3.2 Preview (Build #JBC-223.8617.20). Previous local and remote versions have not had this issue. I was able to fix it by adding -Djdk.lang.Process.launchMechanism=vfork to the "Shared build process VM options" setting under Build, Execution, Deployment > Compiler.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/900336

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX