Configuring Maven for Windows 7, Files\Java\jdk1.6.0_23"" was unexpected at this time error

Andrei picture Andrei · Mar 13, 2013 · Viewed 17.3k times · Source

I am trying to configure Maven on my Win 7 machine. I am following these steps: http://maven.apache.org/download.cgi I downloaded Maven into folder c:\Program Files\Apache Software Foundation\apache-maven-3.0.5\

I set all environmental variables as described in the URL above

JAVA_HOME = C:\Program Files\Java\jdk1.6.0_23
M2_HOME = c:\Program Files\Apache Software Foundation\apache-maven-3.0.5\
M2 = %M2_HOME%\bin
PATH = %M2%; C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;     %JAVA_HOME%\bin ; C:\Program Files\Java\jdk1.6.0_23

But when I enter: C:\Users\Andrei>mvn --version

I get a :

Files\Java\jdk1.6.0_23"" was unexpected at this time.

Can you please help me with this issue? Let me know please if you need more details. Thanks in advance!

Answer

JHP picture JHP · May 30, 2013

This one solved it for me: http://www.xinotes.net/notes/note/559/

It is a problem with how the JAVA_HOME path is being set.

Set the path without quotes like this:

set java_home=c:\Program Files\Java

Or using the 8 char syntax for folder names like this:

set java_home="c:\Progra~1\Java"