The official Oracle JDK is not available for download from the local repository. You have to download the .rpm package from the Java SE Downloads page (here) Note This guide assumes version 11.0.4 is beeing installed.
yum localinstall jdk-11.0.4_linux-x64_bin.rpm
You can verify the version installed like this.
java --version
Next choose which version of Java you would like to run this is done like this.
alternatives --config java
Note By default the newest version will be selected by default so normally you dont have to do anything about this.
Find out where Java is installed.
update-alternatives --config java
From the above take note i.e the output from "update-alternatives --config java" take note of the path where Java is installed the "/usr/lib/jvm" part of things.
Next adjust the shell profile for all users including root to reflect the Java environment for most people that would be the .bash_profile file.
vi .bashrc
Add the following which should reflect the output from the command "update-alternatives --config java"
Example: If the output from the above is /usr/java/jdk-11.0.4/bin/java
Then add the following to .bash_profile
JAVA_HOME=/usr/java/jdk-11.0.4 PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME PATH
Remember to add this for all users including root.
yum remove jdk-11.0.4_linux-x64_bin.rpm