Download java.tar.gz file
Unzip to /usr/java/jdkVERSION
Create link for latest and default
Use alternative to setup default java envirement
See your current envirement
alternatives --config java There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64/jre/bin/java) Enter to keep the current selection[+], or type selection number: 0
Delete current java version
alternatives --remove java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64/jre/bin/java
Add java new java version to configuration
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 1
1 – position of java version in your configuration ( In my case I removed older version and my position is 1)
Check configuration
alternatives --config java There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/java/latest/jre/bin/java Enter to keep the current selection[+], or type selection number: 1
java version
java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)