The previous method of installing Java on CentOS is deprecated. If you are sure that the versions of Java that are provided by the distribution are not useful for you, please follow these instructions to install Oracle's Java Runtime Environment. The same instructions work for the JDK, just use the JDK instead of the JRE package.