Keeping Oracle JRE updated?

Issues related to applications and software problems
mntbighker
Posts: 38
Joined: 2014/11/05 02:00:11

Keeping Oracle JRE updated?

Post by mntbighker » 2015/04/23 19:40:14

Has anyone figured out a way to keep a previously yum local installed Oracle JRE updated, without the laborious process of checking the confusing Oracle site periodically for a newer version? It seems someone has put together a resource for Ubuntu/Debian to do it. I'm putting the Oracle JRE on all of my deployed desktop systems. I don't guess Oracle built in an updater like the Windows and Mac JRE's have?

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Keeping Oracle JRE updated?

Post by TrevorH » 2015/04/23 20:09:22

Oracle's RPMs come with a license agreement that does not allow for onward distribution so it's not possible for anyone to set up a repo that contains them except Oracle themselves. I'm not aware that there is such a repo.

When I was accessing an HP iLO remote console last night though, my web browser popped up a notification that my JDK was out of date and asked if I would like to update it. That's about the nearest that I've seen to anything like this.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

mntbighker
Posts: 38
Joined: 2014/11/05 02:00:11

Re: Keeping Oracle JRE updated?

Post by mntbighker » 2015/04/23 20:13:53

TrevorH wrote:Oracle's RPMs come with a license agreement that does not allow for onward distribution so it's not possible for anyone to set up a repo that contains them except Oracle themselves. I'm not aware that there is such a repo.

When I was accessing an HP iLO remote console last night though, my web browser popped up a notification that my JDK was out of date and asked if I would like to update it. That's about the nearest that I've seen to anything like this.
That figures. Do you know if java will notify you on the command line about updates so you can at least run a cron job that checks if updates are pending?

mntbighker
Posts: 38
Joined: 2014/11/05 02:00:11

Re: Keeping Oracle JRE updated?

Post by mntbighker » 2015/04/24 04:05:08

Not really a solution but my short term hack is:

Code: Select all

#!/bin/bash

LOCAL=`ls /var/www/html/kickstart | grep jre-8`
URL="http://javadl.sun.com/webapps/download/AutoDL?BundleId=106239"
GET=`curl -Is $URL | grep Location`
FILE=`echo $GET | sed -e "s/.*\(jre-8.*rpm\).*ext=.*/\1/"`

if [ $LOCAL == $FILE ]; then
  exit
else
  echo "There is an Oracle JRE update available" | /bin/mail -s "java version check" root
fi
The question will be how long Oracle keeps that URL valid. All this does is check the URL against the RPM I have sitting in my kickstart file directory. Which should be the last one I installed the last time I found an update.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Keeping Oracle JRE updated?

Post by aks » 2015/04/24 11:37:58

As an alternative use the OpenJDK. They both use HotSpot JIT. What you'll loose is some of the JMX and management stuff.
I know the OpenJDK was pretty rubbish sometime ago, but it has improved - give it a try with you application(s).

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Keeping Oracle JRE updated?

Post by aks » 2015/04/24 11:40:04

Oh, and also the GC algorithms.

mntbighker
Posts: 38
Joined: 2014/11/05 02:00:11

Re: Keeping Oracle JRE updated?

Post by mntbighker » 2015/04/24 19:48:00

aks wrote:As an alternative use the OpenJDK. They both use HotSpot JIT. What you'll loose is some of the JMX and management stuff.
I know the OpenJDK was pretty rubbish sometime ago, but it has improved - give it a try with you application(s).
The Elasticsearch folks recommend using the Oracle stuff. Or at least the Elasticsearch community at large does.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Keeping Oracle JRE updated?

Post by aks » 2015/04/26 14:04:05

Well if your application can only use Oracle Java, then you have no choice, either use the ideas from the scripts posted above or ask Oracle to setup a repository (I'm sure they'll do that for you if you give them lots and lots of $$$$$$$$$)

giulix63
Posts: 1305
Joined: 2014/05/14 10:06:37
Location: UK

Re: Keeping Oracle JRE updated?

Post by giulix63 » 2015/04/28 08:46:01

Horrible hack for horrible hack :D, I thought I'd share mine (applies to the JDK):

Code: Select all

#!/bin/bash
isUpToDate() {
    URL=http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
    NEW=$(/usr/bin/wget -qO - $URL |grep ^downloads |head -1 |grep -Eo 'jdk-....')
    NEWVER=`echo $NEW |grep -Eo [0-9].* |grep -Eo '[0-9]*'`
    read -a NEWARR <<< $NEWVER
    OLD=$(javac -version 2>&1 |grep -Eo [0-9].*)
    read -a OLDARR <<< `echo $OLD |grep -Eo '[0-9]{1,2}'`
    return $([ ${NEWARR[0]} -eq ${OLDARR[1]} -a ${NEWARR[1]} -eq ${OLDARR[3]} ])
}
if isUpToDate
then
    echo "Java is up to date"
else
    echo "Java needs to be updated"
fi
Adjust URL with the page of applicable version (7/8/arm/etc.)
Last edited by giulix63 on 2015/05/05 09:20:50, edited 1 time in total.
Root is evil: Do not use root (sudo) to run any of the commands specified in my posts unless explicitly indicated. Please, provide the necessary amount of context to understand your problem/question.

mntbighker
Posts: 38
Joined: 2014/11/05 02:00:11

Re: Keeping Oracle JRE updated?

Post by mntbighker » 2015/04/29 20:06:45

The most irritating thing about these hacks is that they rely on Oracle not changing these fairly cryptic URL's.

Post Reply