Reputation: 3840
In order to set my classpath environment variable, I'm running the following command:
export CLASSPATH=/path/to/appropriate/dir
In order to check that this was correctly set, I'll type
echo $CLASSPATH
and am returned /path/to/appropriate/dir.
However, when I open up a new tab or window in the terminal
echo $CLASSPATH
returns nothing. What's going on here?
Upvotes: 1
Views: 6528
Reputation: 19
After you set the CLASSPATH variable in you ~/.bashrc
file remember to enter source ~/.bashrc
in the terminal.
Upvotes: 0
Reputation: 1
Upvotes: 0
Reputation: 277
for bash, add the following lines to this file (~/.bashrc):
PATH=[your path]:$PATH export PATH
for more details check PATH and CLASSPATH
Upvotes: 0
Reputation: 213193
The variable you set in a terminal, is valid only for that terminal. What you should do is, export the variable in your ~/.bashrc
file, which is loaded for each terminal. So, add that statement in the .bashrc
file, and you'll be fine.
You can also export the variable from ~/.bash_profile
file, which will be loaded for login shells.
Upvotes: 3