flogiston

Blog

Linux - Add an environment variable to your profile

· admin · Linux

Just something for myself. I had to install maven at the office and had to search again how to add the environment variables to my profile and have them effective immediately, without logging off/on again.

Step 1: open your profile file (from your home dir):

gedit .bashrc

Step 2: add the variable(s):


export M2_HOME=/usr/local/apache-maven/apache-maven-2.0.10
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$M2:$PATH

Step 3: save the file (obviously)
Step 4: source the file (i.e. read and execute all commands in the file):

source .bashrc

Step 5: verify the path variable:

echo $PATH

Step 6: finally, verify the maven configuration:

mvn -version