Centos7安装Oracle JDK8

Centos7自带了OpenJDK1.8,我们不想要。想用JDK8,怎么办:

  • Download JDK1.8 rpm:
    wget http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.rpm
  • Install JDK1.8:
    sudo rpm -ivh jdk-8u101-linux-x64.rpm
  • Switch from Open JDK to Oracle JDK:
    sudo alternatives --config java* (Select the item for jdk1.8) *
  • Check it:
which java
java -version
which javac
javac -version

你可能感兴趣的:(Centos7安装Oracle JDK8)