linux安装配置jdk
tar -zxvf jdk-8u111-linux-x64.tar.gz -C /opt
vim /etc/profile
export JAVA_HOME=/opt/jdk1.8.0_111
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
卸载自带的openJDK:
sudo apt-get remove openjdk*
sudo apt autoremove
设置默认jdk:
sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_111/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_111/bin/javac 300
#通过上一步将安装的jdk加入java选择单,然后执行代码:
sudo update-alternatives --config java
sudo update-alternatives --config javac