Tutorials/Tips

How to install Oracle JRE on Fedora 20 and use alternatives to switch between it and OpenJDK

All the Java components installed on Fedora (20) are provided by OpenJDK (Open Java Development Kit), a Free Software implementation of Java SE (Standard Edition).

It’s all you’ll need except when you have to install an application that requires Oracle JRE (Java Runtime Environment). One such application is the community edition of Datastax Cassandra, a NoSQL database. I thought I could uninstall OpenJDK and install Oracle JRE, but tightly-coupled dependencies made it a non-trivial task.

Later I found that both versions of Java (JRE) can live happily on the same machine by the use of the alternatives system, which is what this post is all about: How to install and use Oracle JRE on a Fedora machine that has OpenJDK JRE already installed. I wasn’t sure how this was going to play out, but so far, it has worked for me.

Here’s how I did it.

1. Download Oracle JRE: You can do that by visiting Java SE Downloads. For my installation, I downloaded the Java SE 7u67 version, to match the installed OpenJDK version. Save the RPM file to your Downloads folder.

Related Post:  So I just bought my first Apple product in 19 years

2. Install Oracle JRE: To install it, cd to the Downloads folder, su to root, then type: yum install jre-7u67-linux-x64.rpm. It will be installed in the /usr/java directory. An ls of that directory will show the version you just installed. It should be jre1.7.0_67. OpenJDK is installed in /usr/bin/java. If you type java -version, the output should tell you what version the system is using. It should read something like this:


java version "1.7.0_65"
OpenJDK Runtime Environment (fedora-2.5.2.5.fc20-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

3. Configure the system to use Oracle JRE: This is where the alternatives command comes in. And it has to be run as root. To set up the newly installed Oracle JRE for use by the system, type: alternatives --install /usr/bin/java/ java /usr/java/jre1.7.0_67/bin/java 20000. After that command, the system will still be reporting OpenJDK when you query for the installed version. To change that, type: alternatives --config java. The system will present the two versions installed. Select the option 2, which should be Oracle JRE. Afterwards, query for the installed version to verify that the system is now using Oracle JRE. If you ever need to switch back to OpenJDK, just run the alternatives --config java.

Oracle Java JRE
Using alternatives to switch between Oracle JRE and OpenJDK JRE on Fedora 20
Please share:

We Recommend These Services

Register now for Big Data & AI Conference, international Big Data and AI conference in Dallas, TX (USA), June 27 - 29, 2019

Reasons to use control panel for your server

Register for the End-to-end Machine Learning with TensorFlow on Google Cloud Platform workshop. It will be conducted by the manager of Google's Cloud AI Advocacy team

Launch an SSD VPS in Europe, USA, Asia & Australia on Vultr's KVM-based Cloud platform starting at $5:00/month (15 GB SSD, 768 MB of RAM).


Leave a Comment

Your email address will not be published. Required fields are marked *

*