《-----教你在Kali下安装Java环境-----》
1. 下载1.8u121的JAVA JDK
下载地址:http://java.sun.com/javase/downloads/index.jsp
2. 解压缩文件并移动至/opt
tar -xzvf jdk-8u91-linux-x64.tar.gz mv jdk1.8.0_91 /opt cd /opt/jdk1.8.0_91
3. 设置环境变量
执行 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
4. 安装并注册
执行:
update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_121/bin/java 1 update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_121/bin/javac 1 update-alternatives --set java /opt/jdk1.8.0_121/bin/java update-alternatives --set javac /opt/jdk1.8.0_121/bin/javac查看结果:则说明安装成功。
时间: 2024-12-17 17:41:26