Tuesday, 24 June 2014

Installing and Using Oracle Java7 on Red Hat Enterprise Linux

So, having downloaded the latest Oracle JRE from here: -


I wanted to set it as the default JVM on my Red Hat Enterprise Linux Server release 6.5 (Santiago) box ( instead of the stock OpenJDK JVM ): -

$ java -version

java version "1.6.0_30"
OpenJDK Runtime Environment (IcedTea6 1.13.3) (rhel-5.1.13.3.el6_5-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
[root@rhel6 ~]# /usr/sbin/update-alternatives --install /usr/java/latest
alternatives version 1.3.49.3 - Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.


Add the new JRE as an option

$ /usr/sbin/update-alternatives --install /usr/bin/java java7 /usr/java/latest/bin/java 2

Configure my chosen JRE

$ /usr/sbin/update-alternatives --config java7

There is 1 program that provides 'java7'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/java/latest/bin/java

Enter to keep the current selection[+], or type selection number: 1


Validate

$ java -version

java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)


Thanks to this blog post for sharing: -



No comments: