Installing maven on windows 7 64bit
Asked Answered
S

9

15

I want to create a Tapestry Skeletion Project. I follow to these guide: http://maven.apache.org/download.html#Installation, http://juanjoefe.com/tutoriales/instalar-maven-en-windows-7/ and other guides on the internet.

But, when I type "mvn --version" or "mvn -version", I always receive error "mvn is not recognized as an internal or external command, operable program or batch file.

My friends use Windows 7 x86, and they had no problem. How can I install Maven 3.0.3 on Windows 7 x64?

Stlouis answered 28/8, 2011 at 7:34 Comment(2)
Did you add %M2_HOME%/bin to your PATH environment variable? That should be all you need to do, assuming that you installed everything else as per the instructions on that page.Mistranslate
having the same problem on my 64 bit windows 7: maven dir is in path, and i've restarted the system without any luckEngineman
C
22
  1. navigate to the Maven directory (e.g. in your explorer)
  2. go to a dir IN the bin
  3. copy the address in the address bar (F4 or CTRL+L, must end with bin)
  4. go to Start and type in env
  5. Select "edit the system evironment variables"
  6. find the PATH variable which must also have an existing value for Java as Maven needs Java.
  7. append a ; + paste the previously copied path.
  8. restart to update system
  9. run mvn install in the cli.

Yucca

Chasidychasing answered 28/8, 2011 at 7:55 Comment(4)
you do not need to restart the system .. just close all open command prompts and reopen themDirigible
? Care to elaborate? These are instructions to set your PATH permanently and there are NO command prompts open for this methodology. To my knowledge any interaction with the prompt is only kept for a session or until the prompt is closed. I am sure the user wants his mvn commands visible at each login without having to reconfigure the PATH each time?Chasidychasing
i was referring to step number 8. try changing your environment variables and just closing the cmd and reopening would result in the environment variables being refreshed for your new cmd sessions as well.Dirigible
Yes you do not need to restart Windows to update Path variables. Just start a new command line. Also answer with using path variables like MAVEN_HOME and adding them to path with %MAVEN_HOME% is a little bit more compact.Decrescendo
D
17

Setting up Maven 3.0.4 in Windows 7 64 bit

  • Right Click My Computer → Properties → Advanced System Properties → Environment Variables → System Variables

  • Click "New"

  • Add

M2_HOME=C:\maven\apache-maven-3.0.4
M2=%M2_HOME%\bin

Assuming JAVA_HOME is already setup.

  • Edit Path environment variable and add %M2% as ;%M2% at the end of the existing path

Example:

C:\Users\arun.bc\oraclexe\app\oracle\product\10.2.0\server\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Dell\DW WLAN Card;C:\Ruby193\bin;C:\Borland\BCC55\Bin;%JAVA_HOME%/bin;%M2%

Apply and Close the System Properties

Open a new command prompt and type

mvn --version

The following message should be displayed:

C:\Users\arun.bc>mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: C:\maven\apache-maven-3.0.4
Java version: 1.7.0_03, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_03\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Duane answered 23/9, 2012 at 6:26 Comment(3)
Worked for me aswell! I am using it with Android Studio for compiling a Google CLoud app Engine project.Towny
Thank you I did know how to do all these steps but it was not working, then I found out in your example that you don't have ; at the end of the path so keep that in mind, last entry appended to path doesn't need ;Decrescendo
This worked. I wonder, however, about why the order matters in this case: if `%M2% is not the last one, it would not work.Puseyism
G
3

I had the same issue but was able to fix it.

When I set up maven_home, I had a semi-colon ; at the end. So when I set up path it become MAVEN;\bin .... I removed the semi-colon ; at the end and problem solved.

For some reason the ; does not matter in Windows XP, but is a problem in Windows7 (32 bit).

Nathan

Genome answered 27/6, 2012 at 15:1 Comment(1)
Was this MAVEN;\bin added automatically or did you add it manually and make a mistake initially? ';' is a directory separator in Windowses, so XP must have found the mvn executable in some different way ... If maven install put it there, it sounds like a maven bug and ought to be reported or the bug report linked here.Lovelady
C
2

You can also have multiple Maven installations in your PATH like I do:

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\glassfish3\jdk7\bin;C:\DEV\servers\apache-tomcat-7.0.5\bin;C:\Program Files (x86)\Java\jdk1.6.0_25\bin;C:\DEV\apache-maven-3.0.3\bin;C:\DEV\apache-maven-2.2.1\bin;C:\Program Files (x86)\Windows Live\Shared 

The first Maven bin (Maven 3), is used before my previous (Maven 2).

Chasidychasing answered 28/8, 2011 at 8:42 Comment(0)
A
1

You must add the directory containing the mvn executable to your PATH environment variable.

Abase answered 28/8, 2011 at 7:39 Comment(0)
T
1

Windows sort all variables by alphabet. Don't use multiple elements to construct path to maven like M2 for folder /bin and M2_HOME for root folder JUST take full path to \bin directory of maven and put it in the Path variable

Troostite answered 26/11, 2012 at 14:47 Comment(0)
I
0
  1. Just set the system environment variable rather than user variable
  2. set the M2_HOME as: C:\Program Files\apache-maven-3.1.1 rather than : C:\Program Files\Apache Software Foundation\apache-maven-3.1.1 (I don't know why, but it seems that the space really matters!)
Intermix answered 23/10, 2013 at 7:5 Comment(0)
P
0

I faced with this problem when use maven 3.3.3. Then tried with maven 3.3.9, it worked! Solution is download new version of maven.

Puto answered 13/4, 2016 at 14:44 Comment(0)
T
0

Solved my issue by doing the following:

  1. As per Maven [Install] section page, It says: "Extract distribution archive in any directory". So extracted files in G: drive and hence this was the cause root.

  2. Shifted the downloaded folder to C: drive solved my issue

  3. Updated environment variables. Closed and re-open the command prompt.

Tennes answered 10/3, 2019 at 10:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.