I'm new to Maven and I have downloaded the 3.0.5 version. I'm getting the following error:
JAVA_HOME is set to an invalid directory. please set the java_home variable in your environment variable to match the location of your java installation
Although, I see no error when I type javac or echo %M2_HOME% in the command prompt.
I have the following path variables set -
CLASSPATH - ;C:\Program Files (x86)\Java\jdk1.7.0_40\lib;
JAVA_HOME - C:\Program Files (x86)\Java\jdk1.7.0_40\bin
M2 - %M2_HOME%\bin
M2_HOME - C:\Users\cbil\Documents\Maven\apache-maven-3.0.5-bin\apache-maven-3.0.5
MAVEN_OPTS - -Xms256m -Xmx512m
PATH - C:\Program Files\Java\jdk1.7.0_45\bin;C:\Users\cbil\Documents\Maven\apache-maven-3.0.5-bin\apache-maven-3.0.5\bin;
Can someone please help me?
解决方案
M2_HOME points to the directory where maven is installed.
M2 points to the bin directory under maven
JAVA_HOME points to the JDK directory installed on your system.
validate it again from below settings:
JAVA_HOME - C:\Program Files\Java\jdk1.6.0_23
M2_HOME - D:\Software\apache-maven-3.0.5
M2 - %M2_HOME%\bin
PATH - %M2%;%JAVA_HOME%\bin