This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Trouble with Maven installation on Win 7 - broken Path system variable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Trouble with Maven installation on Win 7 - broken Path system variable?" Watch "Trouble with Maven installation on Win 7 - broken Path system variable?" New topic
Author

Trouble with Maven installation on Win 7 - broken Path system variable?

Dave Nice
Greenhorn

Joined: Jan 06, 2013
Posts: 12
Hi,

I'm trying to install Maven and to make the process easier, have installed Rapid Environment Editor. I cannot get the installation to work but I think REE has helped me discover the reason - the 'Path' System Variable is in red and showing as broken. I have no idea what it should be and am loathe to tinker in case I make major screw ups to the system. Can anyone help with this??

The full Path is as follows:

Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\

I am running Win 7 on an 8GB machine.

Thanks
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Dave,
Welcome to CodeRanch!

I don't see Maven in your path. Are you expecting it to be there?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Dave Nice
Greenhorn

Joined: Jan 06, 2013
Posts: 12
Hello Jeanne,

Thanks for your reply. I'm a little confused all round (easily done). I know that, to get Maven working I need to put the following variable entry in System Variables:

M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-3.0.4

I also need this variable in Path:

%M2_HOME%\bin

I cannot see the variable in the Path, but when I try and add it, it tells me it already exists. Now, in REE, my Path is red which tells me it is broken (was broken even before the Maven installation).

Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\

So, I don't know if the fact it is broken is causing the fail in the Maven installation, or if I am doing something wrong with the installation and, of course, I need to fix the Path!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

What is REE? (Oh, OK, I see that you already said what it is. My recommendation: get rid of REE! It's just messing things up. See the second paragraph below for the starting steps)

Exactly where are you getting the environment variable values from that you are posting? From a command prompt?

Also, after you set M2_HOME and PATH, did you then open a new command prompt?

Finally, describe in detail exactly what you are doing to set the env vars. Example: right-clicked Computer, clicked Properties, clicked Advanced System Settings, clicked Environment Variables, under User Variables for XXX clicked New... (and so on). Also state the exact version of Windows. I am asking for this because based on what you wrote so far, it should have worked, so my only conclusion is that I am making assumptions about exactly what you did - if I could watch over your shoulder I could probably spot the issue right away, but I cannot do that so I need a blow-by-blow description.


JBoss In Action
Dave Nice
Greenhorn

Joined: Jan 06, 2013
Posts: 12
Ok, sorry for the delayed reply. I moved to another machine to try and resolve the issue. I am now working on a Windows 8 machine. I have installed Maven to here:

C:\Program Files\Apache Software Foundation\apache-maven-3.0.4

I have the following variables now set in Windows:

System:
M2_HOME=C:\C:\Program Files\Apache Software Foundation\apache-maven-3.0.4;
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_11

Path=%M2_HOME%\bin;%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

The Path is showing as broken after I add %M2_HOME%\bin but it seems fine with %JAVA_HOME%\bin but I've no idea why.

These are the variables that are given in Maven installation homepage.

I still get a negative when doing a 'mvn -version' in command prompt.

Any further advice much appreciated.

Dave
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Your M2_HOME is incorrect - the drive letter appears twice, and there should not be a ";" at the end. The correct value should be:

M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-3.0.4

That should do it. If it still doesn't work, from the command line, enter "set PATH" and post the output. (Looking at the setting for PATH is all well and good, but you really need to examine the resulting PATH after all of the env vars have been interpreted to see what is really going wrong)

But take my advice and do not install any Java components into Program Files (or into any folder where there is a space in the path). On my systems I create a c:\apps\Java directory and place Maven, Ant, Eclipse, Tomcat, etc, etc, etc there. Spaces in paths can give fits to some Java code - I have solved way to many issues in the Java Ranch forums by having people move their Java apps out of Program Files and Documents and Settings (the later of which has not been an issue since Vista...)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble with Maven installation on Win 7 - broken Path system variable?