kali 设置 Java 版本,并更换为 1.8 版本
1.安装 JDK
1.下载java 1.8 :https://repo.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-linux-x64.tar.gz 2.建立目录,将下载的 jdk 的安装包复制过去并进行解压sudo mkdir -p /usr/local/java cp jdk-8u202-linux-x64.tar.gz /usr/local/java cd /usr/local/java sudo tar xzvf jdk-8u202-linux-x64.tar.gz3.配置环境变量(注意下面的版本号要与自己下载的相同) 打开文件/etx/profile:sudo vim /etc/profile 添加下列代码到文件末尾:
JAVA_HOME=/usr/local/java/jdk1.8.0_202 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH4.通知系统 java 的位置
sudp update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_202/bin/java" 1 sudp update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_202/bin/javac" 1 sudp update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_202/bin/javaws" 1 sudp update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_202/bin/javaws" 1
5.重新载入 profile:source /etc/profile
2.切换 jdk 版本
命令:update-alternatives --config java输入 jdk 版本前对应的数字
过段时间查看 jdk 版本已经切换成功:java -version
标签:bin,Java,jdk,kali,javaws,usr,版本,java,local From: https://www.cnblogs.com/luoluostudy/p/18161115