I am trying to understand how classpath really works. After searching around the web this is where I have reached so far:
I have added
export CLASSPATH="/home/foo:/home/foo/Java_code/my_code"
at /etc/environment. I am running Ubuntu by the way.
Java finds the path and compiles without problem.
The problem is that if I change the CLASSPATH and then I do: source /etc/environment, the new CLASSPATH is not applied. It is applied if and only if I restart the system. For example if I delete the
export CLASSPATH="/home/foo:/home/foo/Java_code/my_code"
line, then I do source /etc/environment and I finally do echo $CLASSPATH, what I get is /home/foo:/home/foo/Java_code/my_code. I think I should get an empty line, shouldn't I?
Is there a way to apply the changes in PATH or CLASSPATH variables immediately without having to restart the system?
It might help you know that the /etc/environment file originally contained only the following line:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
Thank you for your time.