setting path variable

when i run java version, i get jdk version of the one that is came along with OS, i installed new jdk as below and set the path in .bashrc and sourced by still when i run java -version i get system jdk, how to override system jdk path setting by by user account


[webadmin@centos5 software]$ cd /app/govi/jdk1.6.0_29/bin
[webadmin@centos5 bin]$ pwd
/app/govi/jdk1.6.0_29/bin
[webadmin@centos5 bin]$ cat ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
alias l='ls -ltr'

# User specific aliases and functions
# The following are the environment variables for Java, ANT and JBoss

export JAVA_HOME=/app/govi/jdk1.6.0_29
export PATH=$PATH:$JAVA_HOME/bin

export ANT_HOME=/app/govi/ant-1.8.2
export PATH=$PATH:$ANT_HOME/bin

export JBOSS_HOME=/app/govi/jboss-5.1.0.GA
export PATH=$PATH:$JBOSS_HOME/bin

#export CLASSPATH=$CLASSPATH:/opt/software/junit-4.10.jar:/app/govi/ant-1.8.2_src/build/lib/ant-junit4.jar

# User specific aliases and functions
[webadmin@centos5 bin]$ pwd
/app/govi/jdk1.6.0_29/bin
[webadmin@centos5 bin]$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.8) (rhel-1.22.1.9.8.el5_6-i386)
OpenJDK Client VM (build 19.0-b09, mixed mode)
[webadmin@centos5 bin]$ cat ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
alias l='ls -ltr'

# User specific aliases and functions
# The following are the environment variables for Java, ANT and JBoss

export JAVA_HOME=/app/govi/jdk1.6.0_29
export PATH=$PATH:$JAVA_HOME/bin

export ANT_HOME=/app/govi/ant-1.8.2
export PATH=$PATH:$ANT_HOME/bin

export JBOSS_HOME=/app/govi/jboss-5.1.0.GA
export PATH=$PATH:$JBOSS_HOME/bin

#export CLASSPATH=$CLASSPATH:/opt/software/junit-4.10.jar:/app/govi/ant-1.8.2_src/build/lib/ant-junit4.jar

# User specific aliases and functions
[webadmin@centos5 bin]$ source ~/.bashrc
[webadmin@centos5 bin]$ pwd
/app/govi/jdk1.6.0_29/bin
[webadmin@centos5 bin]$ ./java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode, sharing)
[webadmin@centos5 bin]$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.8) (rhel-1.22.1.9.8.el5_6-i386)
OpenJDK Client VM (build 19.0-b09, mixed mode)
[webadmin@centos5 bin]$
wasmanIT AnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

xtermCommented:
You're putting the system java binary in the PATH before your own:

  export PATH=$PATH:$JAVA_HOME/bin

Change this to be:

  export PATH=$JAVA_HOME/bin:$PATH

That way it will use yours (the PATH variables always honors the first instance found)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wasmanIT AnalystAuthor Commented:
Thank you that resolved the issue
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.