简体   繁体   English

如何在 Mac 上将 Java 路径添加为环境变量 bash_profile

[英]How to add the Java Path as an environment variable bash_profile on Mac

Here is how my bash_profile looks:这是我的 bash_profile 的外观:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/henilshelat/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/henilshelat/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/henilshelat/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/henilshelat/opt/anaconda3/bin:$PATH"

    fi
fi
unset __conda_setup
# <<< conda initialize <<<

enter image description here And here is the location of my Java_Home: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home在此处输入图像描述这是我的 Java_Home 的位置: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home

How and where do I update the path to Java_home?如何以及在哪里更新 Java_home 的路径?

In .bash_profile you just have to insert.bash_profile你只需要插入

export JAVA_HOME=$(/usr/libexec/java_home)

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

相关问题 登录时 ~/bash_profile 中的 $JAVA_HOME 路径来源不正确 - $JAVA_HOME path not sourced correctly in ~/bash_profile at login 在.bash_profile 中设置 JAVA_HOME 不返回正确的路径 - Setting JAVA_HOME in .bash_profile not returning correct path 如何在.bash_profile中设置JAVA_TOOL_OPTIONS? - How to set JAVA_TOOL_OPTIONS in .bash_profile? 我想在Mac上安装Java JDK 8,但是.bash_profile无法检测到JAVA_HOME - I want to install Java JDK 8 on mac, but .bash_profile won't detect JAVA_HOME Mac Mavericks Java无法找到可执行的bash_profile编辑功能 - Mac Mavericks Java unable to locate executable bash_profile edits have not worked .bash_profile无法操作,更新路径无法解决问题 - .bash_profile inoperable, updating path doesn't resolve the issue Maven无法识别在bash_profile中设置的JAVA_HOME - Maven not recognizing JAVA_HOME being set in bash_profile 如何让 JAVA_HOME 显示给我看? 如果我先做 source ~ /.bash_profile 它只会向我显示 - How do I get JAVA_HOME to show me? It only shows it to me if I do source ~ / .bash_profile first 如何在mac上设置java环境变量 - How to set java environment variable on mac 无法在“ / usr / bin / java / bin / java”(-1)中找到可执行文件; bash_profile编辑无法修复 - Unable to locate an executable at “/usr/bin/java/bin/java” (-1); bash_profile edit doesn't fix
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM