[CentOS] java 1.6 and 1.7 on CentOS

Tue Aug 19 19:43:52 UTC 2014
Liam O'Toole <liam.p.otoole at gmail.com>

On 2014-08-19, John R Pierce <pierce at hogranch.com> wrote:
> On 8/19/2014 12:08 PM, Les Mikesell wrote:
>> Yes, I think pretty much everything in recent Linux distributions is
>> aimed at making it more single-user and PC-like instead of a unix
>> server.  Following Apple's lead, I guess. But even a single user may
>> need to run applications with differing requirements. Fortunately you
>> can still set JAVA_HOME and give a full path to either executable -
>> you just have to follow the weird symlinks or list the paths from the
>> rpm to figure out where they really put things.
>
> setting JAVA_HOME generally isn't required for running java at the 
> shell, just putting the right java bin directory first in the path is 
> sufficient...
>
> when you invoke java, it sets JAVA_HOME itself if its not already set.
>
> and, WOW, what a tangled web of symlinks.
>
> export 
> JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64/jre
> export PATH=$JAVA_HOME/bin:$PATH
>
> is the REAL java directory...  but that will change with a minor 
> update.   yuck!!!

Just set JAVA_HOME to /usr/lib/jvm/jre-1.7.0-openjdk, or to
/usr/lib/jvm/jre-1.7.0 if you don't care about the implementation. Those
will survive updates.

-- 

Liam