Maven: tricky JAVA_HOME setting 

There are 2 notes for this topic, click above title to see all notes.
Joined:
08/13/2009
Posts:
172

August 13, 2009 02:59:06    Last update: January 09, 2010 23:36:44
Maven requires JAVA_HOME to be set but the setting is tricky. It doesn't like a PATH inside quotes with a space in it.

C:\>@rem quotes and space doesn't work
C:\>set java_home="C:\Program Files\Java\jdk1.6.0_11"
C:\>mvn --version
Files\Java\jdk1.6.0_11"" was unexpected at this time.

@rem space with no quotes OK
C:\>set java_home=C:\Program Files\Java\jdk1.6.0_11
C:\>mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500)
Java version: 1.6.0_11
Java home: C:\Program Files\Java\jdk1.6.0_11\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows vista" version: "6.0" arch: "x86" Family: "windows"

@rem quotes no space is OK
C:\>set java_home="C:\Progra~1\Java\jdk1.6.0_11"
C:\>mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500)
Java version: 1.6.0_11
Java home: C:\Progra~1\Java\jdk1.6.0_11\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows vista" version: "6.0" arch: "x86" Family: "windows"
C:\>
Share |
| Comment  | Tags
1 comment