I had Open JDK 1.7 on CentOS; I installed Oracle's Java rpm; Oracle Java doesn't seem to exist I had Open JDK 1.7 on CentOS; I installed Oracle's Java rpm; Oracle Java doesn't seem to exist oracle oracle

I had Open JDK 1.7 on CentOS; I installed Oracle's Java rpm; Oracle Java doesn't seem to exist


The Oracle JDK RPMs are horrible.

  • They do not register with the alternatives system.
  • They do not Provide (in RPM terms) "java"
  • They have messed up their RPM 'version string' and rely on Epoch (...)
  • All versions of the JDK (i.e. 1.6 vs 1.7) have the same Epoch

In order to quickly remedy your problem you can run the following:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000

It will register and prefer the Oracle java installation as an alternative. OpenJDK has weight 16000; here we register with 20000. Once you've run this command you can switch between java versions by using the (already mentioned) alternatives --config java command.

As for a less quick fix you can use my virtual java package. It's quite possibly not perfect (I'm open for improvements ;) ), but it Provides java (making my apache-tomcat package happy) and registers with the alternatives system. This virtual package simply depends on jdk...you can find it here: https://github.com/keystep/virtual-java-rpm


Run the following command to see if your JVM is getting listed.

sudo update-alternatives --config java

If your JVM gets listed select it.


Please check that whether your JAVA_HOME points to JDK 6 using echo $JAVA_HOME. In order change your JAVA_VERSION to Java 6, you need to point to the Java development KIT 6. You also need to add the bin directory to the $PATH variable. Please ensure that JDK6 bin directory comes in the $PATH prior to other JDK bin,if any. You can check the version of your Java in the environment by command java -version.The other answer by learningloop is very perfect to switch between different Java configurations