I have an Ubuntu 11.04 Virtual Machine and I wanted to set up my Java development environment. I did as follows
sudo apt-get install openjdk-6-jdk
Added the following entries to ~/.bash_profile
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk export PATH=$PATH:$JAVA_HOME/bin
Save the changes and exit
Open up a terminal again and typed the following
echo $JAVA_HOME (blank) echo $PATH (displayed, but not the JAVA_HOME value)
Nothing happened, like if the export of JAVA_HOME and it's addition to the PATH were never done.
I had to go to ~/.bashrc and add the following entry towards the end of file
#Source bash_profile to set JAVA_HOME and add it to the PATH because for some reason is not being picked up . ~/.bash_profile
- Why did I have to do that? I thought bash_profile, bash_login or profile in absence of those two get executed first before bashrc.
- Was in this case my terminal a non-login shell?
- If so, why when doing su after the terminal and putting the password it did not execute profile where I had also set the exports mentioned above?