kali java安装

2017-12-02  本文已影响0人  dle_oxio

1. 下载最新的JAVA JDK

jdk-8u151-linux-x64

2. 解压缩文件并移动至/opt

tar -xzvf jdk-8u151-linux-x64.tar.gz

mv jdk1.8.0_151 /opt

cd/opt/jdk1.8.0_151

3. 设置环境变量

1)执行 gedit ~/.bashrc , 并添加下列内容

#install JAVA JDK

export JAVA_HOME=/opt/jdk1.8.0_151

export CLASSPATH=.:${JAVA_HOME}/lib

export PATH=${JAVA_HOME}/bin:$PATH

2)执行 source ~/.bashrc

4. 安装并注册

执行:

update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_151/bin/java 1

update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_151/bin/javac 1

update-alternatives --set java /opt/jdk1.8.0_151/bin/java

update-alternatives --set javac /opt/jdk1.8.0_151/bin/javac

查看结果:

update-alternatives --config java

update-alternatives --config javac

5. 测试

java -version

#output

java version "1.8.0_151"Java(TM) SE Runtime Environment (build 1.8.0_91-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

上一篇下一篇

猜你喜欢

热点阅读