Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I added the following to my .bash_profile:

JAVA_HOME=$JAVA_HOME:/usr/java/jdk1.7.0
export JAVA_HOME

However, when I echo $JAVA_HOME it outputs an empty string. Why weren't my changes to .bash_profile reflected in the shell?

share|improve this question
4  
Have you logged in again since the editing of ~/.bash_profile? ~/.bash_profile is executed only when a login shell or bash --login is started. –  manatwork Oct 13 '11 at 10:08
    
thanks, that's worked –  Sergey Oct 13 '11 at 11:27
1  
@manatwork Want to post that as an answer? –  Michael Mrozek Oct 13 '11 at 14:50
    
@MichaelMrozek, I am not so sure. Can not remember ever seeing JAVA_HOME set to a list of paths. I have a bad feeling regarding its correctness, so I prefer not to participate in this, beyond a simple comment. –  manatwork Oct 14 '11 at 6:31

1 Answer 1

up vote 0 down vote accepted

You should add this to your .bashrc file, if you want it set for every interactive shell.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.