V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Richardhtw
V2EX  ›  JetBrains

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

  •  
  •   Richardhtw · 2022-12-05 21:42:20 +08:00 · 1881 次点击
    这是一个创建于 724 天前的主题,其中的信息可能已经有所发展或是发生改变。

    打开 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
    

    有人遇到相似的错误吗?

    4 条回复    2023-02-11 23:26:58 +08:00
    house600
        1
    house600  
       2023-01-10 14:52:44 +08:00
    我也遇到了,有解吗
    house600
        3
    house600  
       2023-01-11 09:48:26 +08:00
    @Richardhtw 我也看到了,加上了 JVM 参数还是不行
    Dxxxxs
        4
    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.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4268 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 04:08 · PVG 12:08 · LAX 20:08 · JFK 23:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.