-1

I have Windows7 and I'm trying to install maven and test it.

But I realised that I have a problem with JAVA and I have to it solve first.

I do Start->Run->cmd

and when I type in the command line,

C:\>mvn clean

I get the following error

ERROR: JAVA_HOME not found in your environment. Please set the JAVA_HOME variable 
in your environment to match the location of your Java installation

So i say: Let's set the PATH for Java and i did:

Start->Control Panel->System->Advanced System Settings->Environment Variable->System Variables

Edit the PATH variable

C:\Program Files\Java\jdk1.6.0_32;C:\apache-maven-3.0.4\bin; But then i get the same error when i do:

C:>mvn clean

Then i typed in the cmd prompt:

  C:\>java -version
  java version "1.7.0_07"
  Java(TM) SE Runtime Environment (build 1.7.0_07-b11)

And I realise that the Java version that is running is not located under the C:\Program Files\Java directory

The only JDKs I have are: jdk1.6.0_29 jdk1.6.0_32

Then I did Run->cmd

C:>where java C:\Windows\System32\java.exe (Recently i downloaded IDE Eclipse and IDE IntelliJ and i don't know if these apps come with the JDK).

c:\ >javac

It's working fine

C:>java

this is also working fine

How to resolve above problem any one can help me out?

Rob Kielty
  • 7,958
  • 8
  • 39
  • 51
user2963481
  • 2,003
  • 6
  • 19
  • 20

1 Answers1

1

The error message clearly indicated you have not set the JAVA_HOME in system variable yet.

The action you have done was only adding java directory into PATH system variable.

What you should do:

  1. Navigate back to Start->Control Panel->System->Advanced System Settings->Environment Variable->System Variables
  2. Create new environment variable called "JAVA_HOME" and set value to directory of your java installation. e.g. "C:\Program Files\Java\jdk1.6.0_32\bin"
Jonathan Liono
  • 556
  • 4
  • 13