CentOS 配置JDK
如果centos自带jdk的话可以卸掉
$ rpm -qa | grep java
python-javapackages-3.4.1-11.el7.noarch
tzdata-java-2017b-1.el7.noarch
java-1.7.0-openjdk-1.7.0.141-2.6.10.5.el7.x86_64
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64 java-1.8.0-openjdk-
headless-1.8.0.131-11.b12.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.5.el7.x86_64
$ sudo rpm -e --nodeps python-javapackages-3.4.1-11.el7.noarch;
sudo rpm -e --nodeps tzdata-java-2017b-1.el7.noarch;
sudo rpm -e --nodeps java-1.7.0-openjdk-1.7.0.141-2.6.10.5.el7.x86_64;
sudo rpm -e --nodeps javapackages-tools-3.4.1-11.el7.noarch;
sudo rpm -e --nodeps java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64;
sudo rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64;
sudo rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.5.el7.x86_64;
开始配置
$ tar -zxvf ~/doc/jdk-8u162-linux-x64.tar.gz -C ~/tools/
$ ln -s ~/tools/jdk1.8.0_162 ~/tools/jdk
$ vim ~/.bash_profile
export JAVA_HOME=/home/user000/tools/jdk
export PATH=$PATH:$JAVA_HOME/bin
$ source ~/.bash_profile
$ java -version
$ javac