下载jdk-8u71-linux-x64.tar.gz
创建jvm文件夹(/usr/lib/jvm)
sudo mkdir /usr/lib/jvm
创建jvm文件夹(/usr/lib/jvm)
sudo tar zxvf jdk-8u71-linux-x64.tar.gz -C /usr/lib/jvm
设置环境变量(全局)
sudo gedit /etc/profile
打开profile文件输入
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_71
export CLASSPATH=".:$JAVA_HOME/lib:$CLASSPATH"
export PATH="$JAVA_HOME/bin:$PATH"
设置系统默认JDK
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_71/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_71/bin/javac 300
sudo update-alternatives --config java
验证JDK
java -version