Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added the following to my .bash_profile:

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
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
@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
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


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.