CentOS system installs JDK
Download jdk from oracle needless to say
Tar zxvf * .tar.gz (* .tar.gz is the name of the downloaded file, decompress.)
Mv * jdk (* is the folder you unzipped, change your name, I change it to jdk, change whatever I like, I'll change this easy to remember)
Mv jdk / usr/local/ (then put the renamed folder in / usr/local/)
Vi / etc/profile (edit the configuration, environment variables)
Add at the end:
JAVA_HOME=/usr/local/jdk
Export JRE_HOME=/usr/local/jdk/jre
Export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
Export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
Then modify the default JDK:
Update-alternatives-install / usr/bin/java java/ usr/java/bin/java 300
Update-alternatives-install / usr/bin/javac javac / usr/java/bin/javac 300
Update-alternatives-config java
Update-alternatives-config javac
Source / etc/profile
Java-version
Javac-version