更新替代错误替代路径不存在

我已经看到许多有关此问题的问题和答案,但我没有弄清楚。当我尝试安装另一个版本为1.7.0_71的jdk并使用以下命令时

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_71/bin/javac 1

而Ubuntu 18.04将返回

update-alternatives: error: alternative path  /usr/lib/jvm/jdk1.7.0_71/bin/javac doesn't exist

And the bashrc presented as

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_71
export JRE_HOME=${JAVA_HOME}/jre # java runtime environment
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib # pay attention to the dot
export PATH=${JAVA_HOME}/bin:$PATH # path

评论