views:

52

answers:

3

I installed jdk1.6.0_16 on enterprise linux 4 and I also set teh JAVA_HOME in my ~/.bash_profile

echo $JAVA_HOME correctly shows the new path of the java file

export JAVA_HOME=/jdk16/jdk1.6.0_16/bin/java

The bin directory is also int he path

However when I do java -version I still see java version "1.4.2"

How do I see newly installed jdk verion when i issue java -version command

+1  A: 
whereis java

Type that in, and it will show you the locations java is kept.

Here is a page about it

Or execute the java binary directly using: /jdk16/jdk1.6.0_16/bin/java -version

PostMan
thanks both for the answers. it works both ways
@ttommy851, it would be polite for you to start awarding some answers... thanks :)
Jeffrey Kemp
+1  A: 

In addition to what PostMan said, you should also modify your PATH envvar in the following way:

export PATH=$JAVA_HOME:$PATH

put this in your bash_profile. This will guarantee you pick up the 1.60 jdk. Also your JAVA_HOME should probably be;

JAVA_HOME=/jdk16/jdk1.6.0_16/bin

that is you shouldn't put the path to the actual java executable in JAVA_HOME. It should point to the java installs bin directory.

ennuikiller
+1  A: 

Executing

which java

will tell you which jvm's executable you're running when you just run java -version.

With multiple JVMs installed, it's best to fully specify the path or set your PATH environment variable appropriately.

Matt