Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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.