# After installing latest Java vesion, java command is still using old Java (fix)

**URL:** <https://community.wowza.com/t/after-installing-latest-java-vesion-java-command-is-still-using-old-java-fix/75>\
**Category:** Wowza Streaming Engine\
**Created:** [June 13, 2008, 4:08am UTC](https://community.wowza.com/t/after-installing-latest-java-vesion-java-command-is-still-using-old-java-fix/75 "2008-06-13T04:08:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [June 13, 2008, 4:08am UTC](https://community.wowza.com/t/after-installing-latest-java-vesion-java-command-is-still-using-old-java-fix/75/1 "2008-06-13T04:08:51Z")

</div>

**Problem**

After installing the latest version of the Java when I run the command **java -version** it still returns the version information for the prevoiusly installed version.

**Solution**

If you platform supports the **alternatives** mechanism, invoke it to select the new version of Java (enter **/usr/sbin/alternatives --config java** :

```auto
# /usr/sbin/alternatives --config java
There are 2 programs which provide 'java'.
  Selection Command
-----------------------------------------------
 + 1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
* 2 /usr/java/jdk1.6.0_06/bin/java
Enter to keep the current selection[+], or type selection number: 2

```

This article describes the comamnds in more detail:

[Linux: alternatives](http://linux.about.com/library/cmd/blcmdl8_alternatives.htm)

If this does not work then you can just update the symbolic link at **/usr/bin/java** to point to the new version of Java. If the new version of Java is installed at **/usr/java/jdk1.6.0\_06** , then execute the commands:

```auto
rm -rf /usr/bin/java
ln -sf /usr/java/jdk1.6.0_06/bin/java /usr/bin/java

```

Charlie

---

<div class="post-metadata">

**Author:** ![Carmel\_Avnon](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Carmel\_Avnon](https://community.wowza.com/u/Carmel_Avnon)\
**Post date:** [July 11, 2008, 10:27am UTC](https://community.wowza.com/t/after-installing-latest-java-vesion-java-command-is-still-using-old-java-fix/75/2 "2008-07-11T10:27:54Z")

</div>

> **Problem**
> 
> After installing the latest version of the Java when I run the command **java -version** it still returns the version information for the prevoiusly installed version.
> 
> **Solution**
> 
> If you platform supports the **alternatives** mechanism, invoke it to select the new version of Java (enter **/usr/sbin/alternatives --config java** :

I was having a similar problem in Ubuntu, where java -version showed

```auto
java version "1.5.0"
gij (GNU libgcj) version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)

```

For me the command to fix it was: **sudo update-alternatives --config java**. Just wanted to add that.

---

<div class="post-metadata">

**Author:** ![Cristiano\_Costantini](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@Cristiano\_Costantini](https://community.wowza.com/u/Cristiano_Costantini)\
**Post date:** [November 27, 2009, 5:05pm UTC](https://community.wowza.com/t/after-installing-latest-java-vesion-java-command-is-still-using-old-java-fix/75/3 "2009-11-27T17:05:18Z")

</div>

Use this command (executed by root) to enable alternative (on CentOS)

```auto
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 2

```
