Reputation: 187
Iam new to linux , and trying to run some maven commands . My environment file content is follows -
JAVA_HOME=/usr/lib/jvm/java-openjdk
export JAVA_HOME
M2_HOME=/home/sam/Downloads/apache-maven-3.3.9
export M2_HOME
PATH=$PATH:$JAVA_HOME:$M2_HOME
export PATH
However whenever i run mvn related stuff once in a terminal and close it and reopen a new session , iam unable to run mvn commands , and i get "not a command " error .
Could any one help me how to rectify it so that i dont see this error again and again and the variables set permanently .
Upvotes: 1
Views: 2241
Reputation: 85
You need to set path for java and maven.
You can do one thing add your path code
JAVA_HOME=/usr/lib/jvm/java-openjdk export JAVA_HOME M2_HOME=/home/sam/Downloads/apache-maven-3.3.9 export M2_HOME PATH=$PATH:$JAVA_HOME:$M2_HOME export PATH
into
~/.bashrc File.
This file is execute every time when you open your terminal. So once you write your export path text in this file it will remain set for all the time.
It is very simple to write your path in ~/.bashrc File.
That's it.
Now close the terminal and reopen it. You can test your updated path is working or not using "mvn".
Upvotes: 1