gpt4 book ai didi

WSLENV fails to set JAVA_HOME in Windows Subsystem for Linux(WSLENV无法在用于Linux的Windows子系统中设置JAVA_HOME)

转载 作者:bug小助手 更新时间:2023-10-28 11:25:02 24 4
gpt4 key购买 nike



In PowerShell I've verified that my JAVA_HOME is set:

在PowerShell中,我已验证是否设置了JAVA_HOME:


Get-Item Env:JAVA_HOME

获取项环境:JAVA_HOME


Name                           Value
---- -----
JAVA_HOME C:\Program Files\Eclipse Adoptium\jdk-11.0.15.10-hotspot

I used WSLENV to share this var:

我使用WSLENV分享了这个变量:


setx WSLENV "JAVA_HOME/p"

SETX WSLENV“JAVA_HOME/p”


Yet when I enter wsl and type env, JAVA_HOME is nowhere to be found

然而,当我进入wsl并输入env时,却找不到JAVA_HOME


I've looked at other posts and help articles and have not found anything of help.

我已经看过其他帖子和帮助文章,但没有找到任何帮助。


I tried exporting the variable from my ~/.profile file too:

我也尝试从我的~/.profile文件中导出该变量:


export JAVA_HOME="/mnt/c/Program Files/Eclipse Adoptium/jdk-11.0.15.10-hotspot/"

EXPORT JAVA_HOME=“/mnt/c/Program Files/Eclipse Adoptium/jdk-11.0.15.10-HotSpot/”


Which "works" except when I try to run gradle it errors saying the JAVA_HOME is an invalid directory... except it's not because I can cd to it.

除非我尝试运行Gradle It错误,指出JAVA_HOME是一个无效的目录...只是这不是因为我可以用CD录制。


I can get it to work for the current session by setting the env variable like this: $env:WSLENV="JAVA_HOME/p"

通过如下设置env变量,我可以让它在当前会话中工作:$env:WSLENV=“JAVA_HOME/p”


But that doesn't persist between sessions.

但这种情况并不会在两次治疗之间持续下去。


更多回答
优秀答案推荐
更多回答

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com