V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
selfi
V2EX  ›  JetBrains

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

  •  
  •   selfi · Dec 5, 2022 · 2619 views
    This topic created in 1240 days ago, the information mentioned may be changed or developed.

    打开 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 replies    2023-02-11 23:26:58 +08:00
    house600
        1
    house600  
       Jan 10, 2023
    我也遇到了,有解吗
    house600
        3
    house600  
       Jan 11, 2023
    @Richardhtw 我也看到了,加上了 JVM 参数还是不行
    Dxxxxs
        4
    Dxxxxs  
       Feb 11, 2023
    @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.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5355 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 08:02 · PVG 16:02 · LAX 01:02 · JFK 04:02
    ♥ Do have faith in what you're doing.