1.下载jdk
下载地址:http://java.sun.com/javase/downloads/index.jsp
卸载kali自带jdk
sudo apt-get remove openjdk-7-jdk
2.解压缩
tar -xzvf jdk-8u261-linux-x64.tar.gz
3.安装gedit编辑器
sudo apt-get update
sudo apt-get install gedit-gmate
sudo apt-get install gedit-plugins
sudo apt-get remove gedit
sudo apt-get install gedit
4.配置环境变量
执行 gedit ~/.bashrc , 并添加下列内容
# install JAVA JDK
export JAVA_HOME=/opt/jdk1.8.0_91
export CLASSPATH=.:${JAVA_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
保存退出
执行 source ~/.bashrc
5.安装并注册
update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_261/bin/java 1
update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_261/bin/javac 1
update-alternatives --set java /opt/jdk1.8.0_261/bin/java
update-alternatives --set javac /opt/jdk1.8.0_261/bin/javac