The $PATH added to .bash_profile is not working after reboot

Solution 1:

First Please note that adding envs to the .bash_profile is not a temporary as indicated in other answer, but your problem is adding in non-suitable place since .bash_profile is called when you login from console which I don't think your case. Please Read the rest and find your solution:

Quoted from http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html:

When you login (type username and password) via console, either sitting at the machine, or remotely via ssh: .bash_profile is executed to configure your shell before the initial command prompt.

But, if you’ve already logged into your machine and open a new terminal window (xterm) inside Gnome or KDE, then .bashrc is executed before the window command prompt. .bashrc is also run when you start a new bash instance by typing /bin/bash in a terminal.

So as I suppose you logged in and use the terminal from inside then you should use the .bashrc instead. run this command:

echo 'export PATH=/opt/devel/tools/apache-maven-3.3.3/bin:$PATH' >>~/.bashrc

Then source it:

source .bashrc

For more information please read this

If you want your variables to be used in .bash_profile also you can do this trick. Add all of your variables in .bashrc then source it from .bash_profile. Add this to your bash_profile:

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

Now when you login to your system whenever it's from a console or GUI you'll get your environment.

Solution 2:

You can add your PATH to ~/.profile

~./bash_profile does not affect terminal emulators, like gnome-terminal, that are started after you log into system.

As an option you can setup PATH in /etc/environment globally.

Solution 3:

Maythux is correct, the variable was declared local, but for it to be seen as a global variable by the system it would have to be exported.

if [ -f ~/.bashrc ]; then 
    . ~/.bashrc 
fi 

Also works in .bash_profile to source $HOME/.bashrc