Error: JAVA_HOME is set to invalid directory
I am trying to run maven install but I always get this error
C: \ Windows \ System32> mvn --version
Error: JAVA_HOME is set to an invalid directory.
JAVA_HOME = "C: \ Program Files \ Java \ jdk1.7.0_51;"
Set the JAVA_HOME variable in your environment to match the location of your Java installation.
I know the error says everything, but I've tried everything here. I have the following setup:
System variables:
M2_HOME: C: \ Program Files \ Apache Software Foundation \ apache-maven-3.3.3
M2: % M2_HOME% \ bin
JAVA_HOME: C: \ Program Files \ Java \ jdk1.7.0_51
I added all the way, maybe someone is interested in it. please take a look at the last part.
Way:
C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\cmd;%M2%;%JAVA_HOME%\bin;
Side of your interest:
%M2%;%JAVA_HOME%\bin;
I tried this by uninstalling %JAVA_HOME%\bin;
too, but it doesn't work as I have this path using SDK install at the beginning of the pathC:\Program Files\Java\jdk1.7.0_51\bin
I tried to add a parameter to custom variables and it doesn't work.
source to share