2

My environment variables are correct? What is the correct way to use them in Ubuntu? I put them at the end of .bashrc file or edit the end of /etc/environment to able to use the $JAVA_HOME and $M2_HOME configuration and on my user?

$JAVA_HOME

JAVA_HOME="/usr/lib/jvm/java-8-oracle/​"
CLASSPATH="JAVA_HOME/lib/:$CLASSPATH"
PATH="$JAVA_HOME/bin/:$PATH"

$M2_HOME

M2_HOME="/usr/share/maven/"
M2="$M2_HOME/bin"
PATH="$M2:$PATH" PATH=$M2:$PATH

1 Answers1

1

In bash you can set variables like this:

export JAVA_HOME=/usr/lib/jvm/java-8-oracle/​

export CLASSPATH=JAVA_HOME/lib/:$CLASSPATH
export PATH=$JAVA_HOME/bin/:$PATH
export M2_HOME=/usr/share/maven/
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

for more info on environment variables you can read https://help.ubuntu.com/community/EnvironmentVariables

Prashant Chikhalkar
  • 2,451
  • 2
  • 19
  • 25