How to add Maven to the Path variable?

In windows:

Download the latest version of Maven from the http://maven.apache.org/ and Navigate to Use --> Download --> Download the Binary zip archive.

1) After the download, unzip the folder and copy it to the folder. (Lets say i have copied to c:\program files\apache-maven-3.52.

2) Setting the path of Maven in environment Variables: Search the Environment Variable --> Edit the System Environment variables--> Navigate to Advanced tab --> Environment Variables

i) MAVEN_HOME : Click New --> Variable Name : MAVEN_HOME , Variable Value: C:\Program Files\apache-maven-3.5.2

ii) M2_HOME : Click New --> Variable Name : M2_HOME , Variable Value: C:\Program Files\apache-maven-3.5.2

iii) Edit the 'Path' Environment Variable --> %M2_HOME%\bin

Testing whether Maven is installed: mvn -version

References:- http://www.baeldung.com/install-maven-on-windows-linux-mac

NOTE : In point iii don't forget to put semicolon(;) before and after.


  1. Open command console
  2. copy this set PATH="c:\program files\apache-maven-3.x.y\bin";%PATH%
  3. cahnge the path accordingly
  4. click enter

it's all set and now check mvn -version