Reputation: 11639
I have downloaded the maven 3.5.0 from here. I have set it in the path:
C:\apache-maven-3.5.0
Then i treid to add it to the path of Windows 7
as below:
Right click on my computer
Properties
Advanced System Setting
Environment Variable
New user variable and added Maven_Home
with value C:\apache-maven-3.5.0
Add it to path variable with: %Maven_Home%\bin
Open cmd
and ask for mvn -version
in desktop
Result:
It does not recognize maven
Upvotes: 53
Views: 408184
Reputation: 1
Class Path:
Variable name: Maven_Home
Variable_value: D:\software\apache-maven-3.9.6
Path:
%Maven_Home%\bin
Upvotes: 0
Reputation: 2415
Its very simple,
Open Start Menu -> View Advanced System Settings -> Environment Variables -> System Variables
Click "New"
Variable Name : MAVEN_HOME
Variable Value: C:\apache-maven-3.6.0
Click "Ok"
Next Add PATH in Same System Variables.
Click "New"
Variable Name : Path
Add a new value by clicking 'New' button in top right corner.
Variable Value : %MAVEN_HOME%\bin
Click "Ok"
Then Open CMD, then run
mvn -version
That's all folks.
Upvotes: 1
Reputation: 161
After doing changes, you need to reopen CMD window. In my case, my terminal window was opened before updating environment variables, and changes were not reflecting there i.e. mvn -version was returning "...not recognized as an internal or external command".
Upvotes: 0
Reputation: 387
Make sure you download the Binary zip file from https://maven.apache.org/download.cgi. Then it should work fine by adding it to the path variable as mentioned in other answers. I've accidentally downloaded the src.zip file and of course it didn't work.
Upvotes: 4
Reputation: 11
Additionally I would add this information that worked for me
After I opened the Environment Variables and followed these steps:
System variables > path > edit > add this one: C:\apache-maven-3.6.3\bin > ok button.
Also I would send my System variables you may need
I am using Windows 10
Upvotes: 1
Reputation: 121
The changes in "System variables" requires system restart to take effect. ( The same for Linux systems also)
Upvotes: 0
Reputation: 115
I had the same problem and fixed the issue by:
Adding the MAVEN_HOME to the USER VARIABLES
Adding the BIN folder to the PATH in the SYSTEM VARIABLES
(conform this video: https://www.youtube.com/watch?v=RfCWg5ay5B0)
Then i could run mvn -version
in a NEW command terminal.
Upvotes: 7
Reputation: 161
it's all set and now check mvn -version
Upvotes: 16
Reputation: 8486
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.
Upvotes: 77
Reputation: 51
Adding
MAVEN_HOME
variable (C:\Program Files\apache-maven-3.5.2) and M2_HOME
variable (C:\Program Files\apache-maven-3.5.2\bin).%MAVEN_HOME%\bin
to the path in system variables .
Then mvn -version in command prompt. Upvotes: 2
Reputation: 3522
1) Make sure JDK is installed, and “JAVA_HOME” variable is added as Windows environment variable.
1) Download the Maven zip file, for example : apache-maven-3.5.0-bin.zip. Unzip it to the folder you want to install Maven. Assume you unzip to this folder – C:\Program Files\Apache\maven
3) Set the environment variables using system properties. Add M2_HOME, M2, MAVEN_OPTS to environment variables.
M2_HOME=C:\Program Files\Apache\maven\apache-maven-3.5.0
M2=%M2_HOME%\bin
MAVEN_OPTS=-Xms256m -Xmx512m
4) Now append M2 variable to System Path.
Append the string ;%M2%
to the end of the system variable, Path.
5) Open Command Console and run this command c:\> mvn --version
you will get bellow output :
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.3.3
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_75\jre
Default locale: en_US, platform encoding: Cp1252
Upvotes: -2
Reputation: 11639
The problem get solved when i edit the path
variable with ;%Maven_Home%\bin;
so i should add the ;
before and after it.
Upvotes: 4