Fruitful
Fruitful

Reputation: 607

Maven Installation - Environment Variables

I am using Maven for the first time on Windows 7 and getting this error:

ERROR: JAVA_HOME is set to an invalid directory.

JAVA_HOME = "C:\Program Files\Java\jdk1.7.0_03\bin"

Please set the JAVA_HOME variable in your environment to match the location of your Java installation

Java version "1.6.0_29" Java(TM) SE Runtime Environment (build 1.6.0_29-b11) Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode)

I've read everywhere online about how to set up the variables properly in windows for a Maven installation, also on this site, but, I can't seem to get my installation working.

Here's my set-up:

System Variables:

JAVA_HOME

C:\Program Files\Java\jdk1.7.0_03\bin

Path

C:\apache-maven\src\bin

Any help would be greatly appreciated.

Upvotes: 0

Views: 3964

Answers (5)

Debasish Rakshit
Debasish Rakshit

Reputation: 19

JAVA_HOME should be like this C:\PROGRA~1\Java\jdk1.7.0_03

Hope this will work!

Upvotes: 0

Fruitful
Fruitful

Reputation: 607

Seemed it was a problem with the latest version of Maven. I used Maven 2.2.1 with the same set-up and it run with no problems.

Upvotes: 0

Sudhakar
Sudhakar

Reputation: 4873

thats because your JAVA_HOME is incorrect

set JAVA_HOME to C:\Program Files\Java\jdk1.7.0_03

also some systems , maven might still throw error because if the path to Java Directory has space i.e Space between Program and Files in the path

You might as well move the java to someother path without space

instead of

C:\Program Files\Java\jdk1.7.0_03

to

C:\Java\jdk1.7.0_03

Edit


Double-quoting the value of JAVA_HOME can also cause this problem

set JAVA_HOME="C:\Program Files\Java\jdk1.6.0"

doesn't work for me, but this does:

set JAVA_HOME=C:\Program Files\Java\jdk1.6.0

Upvotes: 4

Jon Kartago Lamida
Jon Kartago Lamida

Reputation: 854

For environment variable of JAVA_HOME should be like this "C:\Program Files\Java\jdk1.7.0_03\" without bin. Please note that likely you have 2 version of Java installed. Make sure which one that you want to use.

Upvotes: 0

vikingsteve
vikingsteve

Reputation: 40438

set JAVA_HOME to C:\Program Files\Java\jdk1.7.0_03 (without bin)

Upvotes: 2

Related Questions