下面介绍一下Kali下JDK1.8的安装过程
1、下载jdk安装包
点击下面的链接选择合适的JDK版本下载:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2、建立目录,将下载的jdk复制过去并解压
sudo mkdir -p /usr/local/java
sudo cp jdk-8u251-linux-x64.tar.gz /usr/local/java
cd /usr/local/java
sudo tar xzvf jdk-8u251-linux-x64.tar.gz
3、配置环境变量
sudo vim /etc/profile
###复制以下代码到文件结尾
JAVA_HOME=/usr/local/java/jdk1.8.0_251
PATH=$PATH:$HOME/bin:$JAVA_HOME/binexport JAVA_HOMEexport PATH
4、通知系统java的位置
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_251/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_251/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_251/bin/javaws" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_251/bin/javaws" 1
5、设置默认JDK
sudo update-alternatives --set java /usr/local/java/jdk1.8.0_251/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_251/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_251/bin/javaws
6、重新载入profile
source /etc/profile
通过 java -version以及javac -version即可看到是否安装完成
网友评论