Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 want to ask newbie question about environment variables in ubuntu

I'm trying to configure maven3 using /etc/environment. I installed maven manually i.e. unpacked, moved to /opt/maven.

My /etc/environment file

JAVA_HOME="/opt/java/jdk1.6.0_31"
JRE_HOME="/opt/java/jdk1.6.0_31/jre"
MAVEN_HOME="/opt/maven"
PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_HOME:$JRE_HOME:$MAVEN_HOME/bin"

When I replace in PATH $MAVEN_HOME with /opt/maven everything works. If I revert changes -> maven is not installed. Why? I check maven after logout/login.

share|improve this question
up vote 3 down vote accepted

/etc/environment is not a shell script. It is read by the pam_env module during log in, and it doesn't do variable expansions, it only accepts KEY=VALUE pairs. You could instead edit /etc/profile (which is a shell script), and add

PATH=$PATH:$JAVA_HOME:$JRE_HOME:$MAVEN_HOME/bin
share|improve this answer

Your Answer

 
discard

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.