Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java JRE Updating issue with CentOS

Tags:

java

linux

centos

I have just recently installed CentOS on my little server box. I am in the process of transferring my servers from Windows Server to Linux/CentOS, and I'm running into a small problem.

I checked "Install java" when I was installing CentOS because I thought it would speed up the process. However, it installed Java 7, and I need to use Java 8 because our code uses a bunch of new features in Java 8.

I have tried removing Java JRE 7 manually, downloading an rpm, and using yum. However, it seems that Java 7 is still installed, or is overriding the Java JRE 8 install.

I can provide any logs neccessary. Thank you!


rpm -qa 'java*'

java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.el7_0.x86_64
javapackages-tools-3.4.1-6.el7_0.noarch
like image 904
Justin J. O'Boyle Avatar asked Jan 07 '23 15:01

Justin J. O'Boyle


1 Answers

Here is what I did on my CentOS7 box:

yum list installed java*
sudo yum remove java-1.7.0-openjdk java-1.7.0-openjdk-headless

Then I downloaded the JDK RPM from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html (I chose jdk-8u60-linux-x64.rpm). Then installed it using

sudo yum localinstall jdk-8u60-linux-x64.rpm

For me that worked. To track down your java binary, you can do it like this:

[~]$ which java
/usr/bin/java
[~]$ ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22  3. Sep 02:49 /usr/bin/java -> /etc/alternatives/java
[~]$ ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 34  3. Sep 02:49 /etc/alternatives/java -> /usr/java/jdk1.8.0_51/jre/bin/java

If your Java binary is linked in /etc/alternatives, you can use alternatives(8) to choose the desired version.

like image 68
Lars Gendner Avatar answered Jan 17 '23 20:01

Lars Gendner