Java classpath - Linux Java classpath - Linux linux linux

Java classpath - Linux


I think you should not put any paths that a local to your home directory in a system wide file. I would leave /etc/environment well alone, unless you provide some changes, that are necessary or beneficial to all users.Put any changes to the CLASSPATH in your .bashrc in your home directory.

  CLASSPATH=$CLASSPATH:/home/foo:/home/foo/Java_code/my_code  export CLASSPATH

This way you can source it and any newly started bash will have the settings right at once.


 export CLASSPATH=""

or better

 unset CLASSPATH

will delete an existing Classpath. There are multiple locations where you can set or unset the classpath - a missing entry will not unset it.


When you remove

export CLASSPATH="/home/foo:/home/foo/Java_code/my_code"

line and then source ... it wouldn't remove the CLASSPATH because it has already been set. It doesn't clear the variables which have already been defined.