Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Maven to the build process of my Java project.

To launch the mvn command in any position within the shell I am using the following command to declare the environment variable in this way:

export MAVEN_HOME=/home/andrea/SpringSource/apache-maven-3.0.4


The problem is that if I close my shell, when I open it again I have to give again the previous can I solve this problem and "save" the environment variable on my system?

Thank you


share|improve this question

You should save these commands as lines in your ~/.bashrc file. That way, these commands are applied/run each time you start a new instance of bash, i.e. each time you log in.


  • To make the variables system-wide, disregarding which shell you use, assign the variables in /etc/environment (as described here) (alternatively in /etc/profiles).
  • To make the variables system-wide for bash (for all users using bash), place the lines in the file /etc/bash.bashrc (alternatively in /etc/bashrc on some other OSes than Ubuntu)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.