Error: JAVA_HOME is set to an invalid directory for installing maven

3.6k views Asked by At

I have been trying to install Maven on my machine win 7 (64 bit)for the first time.I have a problem setting the path environment System variable . iam getting error JAVA_HOME is set to an invalid directory. i have tried each and every method ehich is mentioned in stack over flow posts but i didnt get a solution. plz help me.![enter image description here][1] here my variables are

CLASS_PATH:C:\Program Files\Java\jdk1.8.0_45\bin\lib

JAVA_HOME:C:\Program Files\Java\jdk1.8.0_45\

M2:%M2_HOME%\bin

M2_HOME:C:\Program Files\apache-maven-3.3.3

MAVEN_HOME:C:\Program Files\apache-maven-3.3.3

PATH:C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Java\jdk1.8.0_45\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\MongoDB\Server\3.0\bin;%M2_HOME%\bin;

1

There are 1 answers

0
Maulik Patel On

1> In Enviroment variable setup screen remove all variable to setup maven.
2> You need to set following variable

JAVA_HOME = C:\Program Files\Java\jdk1.8.0_45
MAVEN_HOME = C:\Program Files\apache-maven-3.3.3    

3> In Path Variable click on edit then set follwing code

;%JAVA_HOME%\bin;%MAVEN_HOME%\bin