TAGS :Viewed: 9 - Published at: a few seconds ago

[ Setting Maven environment variable ]

I been trying to set the Maven environment variable, but it's not liking it. I don't know why, I've triple checked everything and it should be working.

Here is the error I got:

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

And here are my variables:

JAVA_HOME ---> C:\Program Files\Java\jdk1.6.0_26
MAVEN_HOME ----> C:\Program Files\Maven\apache-maven-3.0.5

Path ----> C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;%JAVA_HOME%\bin;%MAVEN_HOME%\bin

Sorry if my path file is a little long. Basically the important part is that I did indeed put them in right, they should both be at the very end. What else could have gone wrong?

Also to clarify a little bit, I did check that the file is indeed where I specify it to be. And I know my Java version should be right, when I do a:

javac -version

in cmd I do get the right version.

Answer 1

Try using M2_HOME instead of MAVEN_HOME in the path and environment variable

M2_HOME ----> C:\Program Files\Maven\apache-maven-3.0.5 and %M2_HOME%\bin in path

Answer 2

As you are using a jdk/maven path with space in between so try using the path in quotes such as : "C:\Program Files\Java\jdk1.6.0_26"


simply dump the java and maven in non-space directories as it avoids such problems. I generally put java in C:\Java\jdk1.6.0_26 and mavin in C:\maven\maven3.0.

Try either of the solutions and you should get lucky :-)

Answer 3

And please ensure to put the JAVA_HOME environment variable inside the system environment variables and not the user environment variables. Don't forget to restart your shell after you changed environment variables.