Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

.profile has

export JAVA_HOME=$DEV_HOME/tools/jdk1.6.0_45
# export JAVA_HOME=$DEV_HOME/tools/jdk1.7.0_51
# export JAVA_HOME=$DEV_HOME/tools/jdk1.8.0
export PATH=$PATH:$JAVA_HOME/bin

I work with multiple versions of Java like above.

So i comment out required version of java from export and then do

source ~/.profile

This changes the JAVA_HOME , but java -version does not changes.

Means the path does not gets updated.

Any idea how can i force path also to have new java version

Thanks

Edit

One solution i found is to add following lines in .profile to reset PATH to default and then add what i have customized

Not sure if this is ideal solution

PATH=""
PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

After that i have my custom path statements like java home etc

share|improve this question
    
I assume the last one has you add your path to path to path. –  Rinzwind Apr 8 at 21:52
    
sorry can you rephrase or write code ? –  user2230605 Apr 8 at 21:54
    
Did you reboot after change .profile? –  xiaodongjie Apr 9 at 2:37
    
No , but i thought .profile can be reloaded if we source without reboot –  user2230605 Apr 9 at 3:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.