I encountered some issues with an application running on Java. I thought it would be fine if running on standard OpenJDK release available at CentOS repository since it is really easy to install with yum, but it wasn’t. The application does required JDK from Oracle release (which is lame).
So here what you should do when you want to replace OpenJDK with Java SE JDK:
1. Check the current OpenJDK version. I am going to retain the same version if possible:
$ java -version java version "1.6.0_30" OpenJDK Runtime Environment (IcedTea6 1.13.3) (rhel-18.104.22.168.el6_5-x86_64) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
Check the current RPM package name:
$ rpm -qa | grep openjdk java-1.6.0-openjdk-22.214.171.124-126.96.36.199.el6_5.x86_64
2. Download Java SE Development Kit 6 update 30, which is equivalent to OpenJDK 1.6.0_30. There is no way (AFAIK) that we can download it directly using curl or wget. You need to have an account with Oracle. Sign up using your web browser and you will get a temporary link similar to below. Copy it from your web browser and use wget to download it directly to the box:
$ wget -O jdk-6u30-linux-x64-rpm.bin http://download.oracle.com/otn/java/jdk/6u30-b12/jdk-6u30-linux-x64-rpm.bin?AuthParam=1397834288_32d1181063a10cd15522d23abbc5e4f7
**You should do this quick. The link will be expired within minutes.
3. Remove the installed OpenJDK package:
$ yum remove -y java-1.6.0-openjdk
4. Install Oracle JDK:
$ chmod 755 jdk-6u30-linux-x64-rpm.bin $ ./jdk-6u30-linux-x64-rpm.bin
5. Verify the new Java version:
$ java -version java version "1.6.0_30" Java(TM) SE Runtime Environment (build 1.6.0_30-b12) Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)
Now my application works like a charm! The new path to JRE now is /usr/java/jdk1.6.0_30/jre/