A few hours ago I had to install DataStax OpsCenter from the DataStax (community) repository on a new installation of Ubuntu 14.04. DataStax OpsCenter is a browser-based management application for DataStax Enterprise, DataStax Community and Apache Cassandra, a distributed NoSQL database.
Cassandra/OpsCenter requires Oracle JRE, but applications installed using Ubuntu’s package manager are hard-wired to use OpenJDK JRE. So if Oracle JRE is installed, it has to be configured to be the default JRE, before or after the installation of OpsCenter. This post show how to get that task done.
To install Oracle JRE, visit the official download page and click on the JRE button for the version of JRE you want to download. For this tutorial, I clicked on the JRE button under the Java SE 7u67 section to download the JRE 1.7 version. On the page that comes up after that, accept the license and download the gzipped tarball for the 64-bit platform (recommended)
If you have not modified the configuration of your browser (Firefox or Chrome), the downloaded file should be in the Downloads folder. Open a terminal and cd into that folder. An ls inside that folder should show the target file. This image shows the listing on my system.
To install it, do the following:
1. Create a directory where the application will be installed:
<strong>sudo makdir -p /usr/lib/jvm</strong>.
2. Unpack and install it. Be sure to replace the version of the tarball used here with the version that you downloaded:
<strong>sudo tar xf jre-7u67-linux-x64.tar.gz -C /usr/lib/jvm</strong>.
3. Oracle JRE is now installed, but the system doesn’t know it yet. If you type java -version, the system will report, provided you have no other JRE installed, that no JRE is installed. You can change that by typing:
<strong>sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.7.0_67/bin/java" 1</strong>
4. Set Oracle JRE as the default:
<strong>sudo update-alternatives --set java /usr/lib/jvm/jre1.7.0_67/bin/java</strong>.
An easier method of setting a default JRE, especially if another JRE is installed, is to use this form:
<strong>sudo update-alternatives --config java</strong> . That will bring up the options shown in this image.
5. After all is done, you can verify the version of JRE the system is using by typing:
<strong>java -version</strong>. If it’s Oracle JRE, you will get an output of the sort shown in this image
Or this, if it’s OpenJDK JRE.