tags:

views:

910

answers:

5

I followed this tutorial to the letter but I still can't get maven installed!!! http://maven.apache.org/download.html#Installation

When I run the following in command prompt: E:\Documents and Settings\zach>mvn --version

I get:

'mvn' is not recognized as an internal or external command, operable program or batch file.

I navigated to the maven install folder and ran mvn --version and got:

E:\java resources\apache-maven-2.2.0\bin>mvn --version

ERROR: JAVA_HOME is set to an invalid directory. JAVA_HOME = "E:\Sun\SDK\jdk\bin" Please set the JAVA_HOME variable in your environment to match the location of your Java installation

but when I run java -version i get: java version "1.6.0_14" Java(TM) SE Runtime Environment (build 1.6.0_14-b08) Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode)

So I do have Java installed. Anyone know what the problem is?

A: 

ERROR: JAVA_HOME is set to an invalid directory. JAVA_HOME = "E:\Sun\SDK\jdk\bin" Please set the JAVA_HOME variable in your environment to match the location of your Java installation

JAVA_HOME should be set to E:\Sun\SDK\jdk. bin should be set for your PATH

dfa
+3  A: 

The problems are to do with your paths.

  1. Make sure that the directory "E:\java resources\apache-maven-2.2.0\bin" is on your command search path.
  2. Make sure that the JAVA_HOME variable refers to the home directory for your Java installation. If you are executing Java from "E:\Sun\SDK\jdk\bin", then the JAVA_HOME variable needs to point to "E:\Sun\SDK\jdk".
Stephen C
A: 

I`m having the same problem! I have followed the instructions but the test command C:>mvn --version wont work...

when i go to maven/bin and run mvn --version from its location it says java_home is C:\Program Files\Java\jre6 .. so then i set the user variable JAVA_HOME to this path

then i add M2_HOME user variable with path C:\Program Files\Java\apache-maven-2.2.1

then i append %JAVA_HOME%\bin;%M2_HOME%\bin to system variable PATH

but the test command is not working!! wot am i doing wrong here?

Imran
1) try restarting your command shell. 2) Make sure that you can run 'java -version'. 3) try running mvn as '%M2_HOME%\bin\mvn --version'. If you have no success, tell us what is being output when `mvn --version` fails.
Stephen C
A: 

helo Stphen,

thanx for ur reply!!

I have somehow figured out how to make it work.. firstly- my OS was taking java 1.4 inside my ORACLE Directory as default java ,,secondly i think the path of m2_home variable was havig problem due to space between Program FILES folder name.. now i have shifted maven to e:\maven\maven , but it didnt work with %M2_HOME%\bin appended in PATH variabe..so i manualy append the whole path ;e\maven\maven\bin and now its working but i doubt if this is a profesional aproach because its working alrigh but it still doesnt match the basic instructions

Imran
A: 

very nice !!! thank you

qvod