# Strange issue installing Java 8

**URL:** <https://community.unix.com/t/strange-issue-installing-java-8/373142>\
**Category:** AIX\
**Created:** [July 12, 2018, 3:51pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142 "2018-07-12T15:51:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffs42885](https://community.unix.com/letter_avatar/jeffs42885/32/6_449c533f586939b6e5f246632a46421f.png) [@jeffs42885](https://community.unix.com/u/jeffs42885)\
**Post date:** [July 12, 2018, 3:51pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/1 "2018-07-12T15:51:42Z")

</div>

I just intalled java8\_64.jre and .sdk respectively

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

```

Worked like a champ. Now I see this--

```nohighlight
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..

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

```

```nohighlight
export PATH

```

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

```nohighlight
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

---

<div class="post-metadata">

**Author:** ![DukeNuke2](https://community.unix.com/user_avatar/community.unix.com/dukenuke2/32/407_2.png) [@DukeNuke2](https://community.unix.com/u/DukeNuke2)\
**Post date:** [July 12, 2018, 4:02pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/2 "2018-07-12T16:02:34Z")

</div>

What is the output of `which java` ?

---

<div class="post-metadata">

**Author:** ![jeffs42885](https://community.unix.com/letter_avatar/jeffs42885/32/6_449c533f586939b6e5f246632a46421f.png) [@jeffs42885](https://community.unix.com/u/jeffs42885)\
**Post date:** [July 12, 2018, 4:09pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/3 "2018-07-12T16:09:13Z")

</div>

Same as whence

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

---

<div class="post-metadata">

**Author:** ![MadeInGermany](https://community.unix.com/letter_avatar/madeingermany/32/6_449c533f586939b6e5f246632a46421f.png) [@MadeInGermany](https://community.unix.com/u/MadeInGermany)\
**Post date:** [July 12, 2018, 4:17pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/4 "2018-07-12T16:17:40Z")

</div>

> [@](#):
>
> ```plaintext
> PATH=/usr/sbin:/usr/localcw/sbin:$PATH:/sbin:/opt/IBM/db2/V9.7/bin:/usr/lib/java8/jre/bin:/usr/java8_64/jre/bin
> 
> ```

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

```plaintext
echo $PATH

```

?

---

<div class="post-metadata">

**Author:** ![DukeNuke2](https://community.unix.com/user_avatar/community.unix.com/dukenuke2/32/407_2.png) [@DukeNuke2](https://community.unix.com/u/DukeNuke2)\
**Post date:** [July 12, 2018, 4:19pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/5 "2018-07-12T16:19:08Z")

</div>

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 😉  
For me `java` is in `/usr/bin` and that is a link to `/usr/bin/java -> /some very long path/java`

---

<div class="post-metadata">

**Author:** ![hicksd8](https://community.unix.com/letter_avatar/hicksd8/32/6_449c533f586939b6e5f246632a46421f.png) [@hicksd8](https://community.unix.com/u/hicksd8)\
**Post date:** [July 12, 2018, 5:04pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/6 "2018-07-12T17:04:26Z")

</div>

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:

```nohighlight
# 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.

---

<div class="post-metadata">

**Author:** ![jeffs42885](https://community.unix.com/letter_avatar/jeffs42885/32/6_449c533f586939b6e5f246632a46421f.png) [@jeffs42885](https://community.unix.com/u/jeffs42885)\
**Post date:** [July 13, 2018, 6:33am UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/7 "2018-07-13T06:33:45Z")

</div>

```nohighlight

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>

```

```nohighlight
# 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

---

<div class="post-metadata">

**Author:** ![MadeInGermany](https://community.unix.com/letter_avatar/madeingermany/32/6_449c533f586939b6e5f246632a46421f.png) [@MadeInGermany](https://community.unix.com/u/MadeInGermany)\
**Post date:** [July 13, 2018, 6:50am UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/8 "2018-07-13T06:50:05Z")

</div>

Either put your new java path before the inherited $PATH

```nohighlight
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.

---

<div class="post-metadata">

**Author:** ![jeffs42885](https://community.unix.com/letter_avatar/jeffs42885/32/6_449c533f586939b6e5f246632a46421f.png) [@jeffs42885](https://community.unix.com/u/jeffs42885)\
**Post date:** [July 13, 2018, 12:50pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/9 "2018-07-13T12:50:53Z")

</div>

> [@madeingermany](#):
>
> Either put your new java path before the inherited $PATH
> 
> ```plaintext
> 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.

This worked. I need to now understand why.

---

<div class="post-metadata">

**Author:** ![MichaelFelt](https://community.unix.com/letter_avatar/michaelfelt/32/6_449c533f586939b6e5f246632a46421f.png) [@MichaelFelt](https://community.unix.com/u/MichaelFelt)\
**Post date:** [August 15, 2018, 3:12pm UTC](https://community.unix.com/t/strange-issue-installing-java-8/373142/11 "2018-08-15T15:12:40Z")

</div>

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).
