Strange issue installing Java 8

I just intalled java8_64.jre and .sdk respectively

installp -agXYd . Java8_64.jre Java8_64.sdk 2>&1 | tee installp.log

Worked like a champ. Now I see this--

jeff@server:/usr> ls -l | grep java
drwxr-xr-x    9 bin      bin             512 Sep 22 2010  java14
drwxr-xr-x    7 bin      bin             512 Oct 13 2015  java5
drwxr-xr-x    8 bin      bin             512 Oct 13 2015  java6
drwxr-xr-x    7 bin      bin             512 Sep 18 2014  java6_64
drwxr-xr-x    3 bin      bin             512 Feb 09 2015  java8_64

I added the path to the profile and resourced/logged out..

PATH=/usr/sbin:/usr/localcw/sbin:$PATH:/sbin:/opt/IBM/db2/V9.7/bin:/usr/lib/java8/jre/bin:/usr/java8_64/jre/bin
export PATH

Everything is how i have done it a million times. Heres the fun part...

jeff@server:/home1/jeff> java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX build ca142-20090307 (SR13) (JIT enabled: jitc))
jeff@server:/home1/jeff> whereis java
java: /usr/lib/java
jeff@server:/home1/jeff> whence java
/usr/java14/jre/bin/java
jeff@server:/home1/jeff>

Anyone have some tips that can help the profile, whereis, whence, which (its the same was whence) all equal java 8. I need to do this for root as well.. thanks in advance

What is the output of which java ?

Same as whence

Sorry. I don't think I can do tags on mobile

Appends the new java path to the existing PATH.
What is the resulting PATH

echo $PATH

?

I don't say you are doing it wrong... But somehow you do... Java should be in your path and that should be a link to the version you are using! Also maybe it is wrong on my site and you are doing it... You decide :wink:
For me java is in /usr/bin and that is a link to /usr/bin/java -> /some very long path/java

I'm with MadeInGermany and DukeNuke2 who are both on track but let me explain this the way I see it.

Normally apps look for Java at either /usr/java or /usr/lib/java (depending on exactly which O/S it is).

However, an installation of jre will install to something like /usr/jrel.8.n or whatever.

The key is that the install directory (e.g. /usr/jrel.8.1) needs to be linked to the apps expected location (e.g. /usr/java) like:

# cd /usr
# ln -s jrel.8.1 /usr/java

then java apps and java version query commands can find the installed jre.

If you had previous versions of jre installed and that directory is still linked to /usr/java (or /usr/lib/java) then your apps will see the old version.

You will need to research what directory your apps expect java to be in and what directory your jre 8 is in, and link them.


jeff@server:/home1/jeff> echo $PATH
/usr/sbin:/usr/localcw/sbin:/usr/sbin:/usr/localcw/sbin:/usr/local/bin:/usr/local/sbin:/usr/java14/jre/bin:/usr/java14/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/lpp/pd/bin:/usr/lpp/psf/bin:/usr/lpp/ars/bin:/usr/lpp/Acrobat3/bin:/app/ondemand/bin:/sybase/OCS-12_5/bin:/usr/vac/bin:/usr/vacpp/bin:/home1/jeff/bin:/bin:.:/sbin:/opt/IBM/db2/V9.7/bin:/usr/lib/java8/jre/bin:/usr/lpp/ars/bin:/sbin:/opt/IBM/db2/V9.7/bin:/usr/lib/java8/jre/bin:/usr/java8_64/jre/bin

jeff@server:/home1/t15krtk> java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX build ca142-20090307 (SR13) (JIT enabled: jitc))
jeff@server:/home1/jeff>



# cd /usr
# ln -s jrel.8.1 /usr/java

Ran with sudo np

---------- Post updated 07-13-18 at 06:33 AM ---------- Previous update was 07-12-18 at 06:12 PM ----------

Any more thoughts

Either put your new java path before the inherited $PATH

PATH=/usr/sbin:/usr/localcw/sbin:/usr/lib/java8/jre/bin:/usr/java8_64/jre/bin:$PATH:/sbin:/opt/IBM/db2/V9.7/bin

Or, better, look where the $PATH comes from (/etc/profile ? /etc/environment ? /etc/default/login ? ... ?) and change it there.
As others said, it can make sense to just backout the old /usr/java14/jre/bin:/usr/java14/bin: and ensure that /usr/bin/java is a link to the desired version.

1 Like

This worked. I need to now understand why.

Did you check your .profile, and/or .kshrc?

If you switch to bash - did you check, iirc, .bashrc

I tend to remove ~/.profile so that my PATH should only be coming from /etc/environment.

And, do consider uninstalling java1.4 (I recently uninstalled Java6*).

p.s. - if you create a new user - what do they see on login (would be caused by .profile in that case! which come, iirc, from /etc/security/.profile (it gets copied by mkuser).