Java 版本问题

Java 版本问题

Ubuntu 版本:16.04 我上次使用的是 Java 11,而且我的电脑上也有 Java 11。不知何故,有些程序无法与 Java 11 配合使用,所以我决定将其删除,但是。删除后我收到很多错误。例如,当我输入以下代码时:

echo $PATH
/home/duygu/bin /home/duygu/.local/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /home/duygu/bin /usr/lib/jvm/jdk-11.0.8/bin

我得到了这条路径,但我没有 jdk-11.0.8 文件,我从 usr/lib/jvm/ 中删除

我尝试过这个:

sudo vi /etc/environment

得到这个:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"

当我打开此文件时:

sudo vim /etc/profile.d/jdk.sh

我明白了:

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH

编辑:当我尝试这个时:source /etc/profile.d/jdk.sh 我得到:s

et: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/home/duygu/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /home/duygu/bin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/home/duygu/.local/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /home/duygu/.local/bin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:usr/lib/jvm/java-8-openjdk-amd64/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH usr/lib/jvm/java-8-openjdk-amd64/bin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/local/sbin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /usr/local/sbin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/local/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /usr/local/bin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/sbin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /usr/sbin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /usr/bin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/sbin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /sbin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /bin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/games may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /usr/games'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/local/games may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /usr/local/games'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/snap/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /snap/bin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/home/duygu/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /home/duygu/bin'?
set: Warning: path component usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/lib/jvm/jdk-11.0.8/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /usr/lib/jvm/jdk-11.0.8/bin'?

我的问题在哪里?我怎样才能完全删除 Java 11 并安装 Java 8?

相关内容