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

久未见 提交于 2019-11-30 08:06:37
JHP

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"

To solve the same issue

I did:

SET M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-3.2.3-bin\apache-maven-3.2.3

Then

SET JAVA_HOME=C:\Program Files (x86)\Java\jre7

And finally I added to the beginning of Path

SET Path=%JAVA_HOME%\bin;%M2_HOME%\bin;...

After exiting all my running cmd.exe and opened a new one I was able to do mvn --version with no problems.

I had the same problem, but the cause was M2_HOME variable defined as:

C:\apache-maven-3.2.2\bin

instead of

C:\apache-maven-3.2.2\

Also the JAVA_HOME should be to the java folder, and not to the \bin sub-folder.

I ran into a similar issue and the problem is with the presence of character "(" in the current directory path where maven is being run eg:- C:\Work(test)\Java-Project. I simply changed it to C:\Work\Java-Project and its working fine now.

For info I'm running Windows 10 with Maven V3.6.0

Insert with windows GUI Environment Variable Configurations > System Variables : Name JAVA_HOME Path C:\Program Files (x86)\Java\jre7\ << with "\" in the end. no quotes.

kill process cmd.exe and re-open if it was opened. It worked to me.

I had the same issue. I didn't have quotes around the values for M2_HOME or JAVA_HOME, but still got the error.

I moved %M2_HOME%\bin and %JAVA_HOME%\bin left in the path so that both occurred before any spaces in the path and the problem vanished.

Anil

Error Message : was unexpected at this time when I run mvn --version command in cmd.

Please find the procedure:

My Computer -> Right click properties-> Advanced-Environment Variables- User Variable

Maven 3.2.3

User Variable :
Variable name :M2 
Variable Value : %M2_HOME%\bin
Variable name : M2_HOME
Variable Value :  C:\WLS1033\Apache Software Foundation\apache-maven-3.2.3
Variable name :path 
Variable Value : %M2_HOME%\bin

Result :

D:\Documents and Settings\x169810>mvn --version
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
Maven home: C:\WLS1033\Apache Software Foundation\apache-maven-3.2.3
Java version: 1.6.0_18, vendor: Sun Microsystems Inc.
Java home: C:\WLS1033\jdk160_18\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"

My Computer -> Right click properties-> Advanced-Environment Variables- User Variable

Maven 1.0.2

User Variable :
Variable name :M2 
Variable Value : %MAVEN_HOME%\bin
Variable name : MAVEN_HOME
Variable Value :  C:\WLS1033\Apache Software Foundation\maven-1.0.2
Variable name :path 
Variable Value : %MAVEN_HOME%\bin
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!