在 Mac 上安装 Java 8

时间:2021-02-08 23:04:53

标签: java installation anaconda conda

我在运行 Mac OS x 10.15.4 的 Mac 上尝试从 Java 11 更改为 Java 8 时遇到问题。当我尝试

/usr/libexec/java_home -V

我得到了

Matching Java Virtual Machines (1):
    1.8.0_281, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home

但是当我 $java -version 时,我收到此错误消息: Error: A JNI error has occurred, please check your installation and try again

然而,当我$javac -version时,我得到: javac 11.0.6

我不知道这怎么可能。我nano ~/.bash_profile: 这是我得到的:

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

# added by Anaconda3 2019.07 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash ho$
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/anaconda3/etc/profile.d/conda.sh"  # commented out by conda initialize
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<
# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/opt/anaconda3/bin/conda' shell.bas$
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/opt/anaconda3/etc/profile.d/conda.sh"  # commented out by conda initialize
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

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

是 miniconda 的问题吗?

0 个答案:

没有答案