Solution to maven Error: JAVA_HOME is set to an invalid directory.
It's easy to resolve this.... all you have to do is enter the java installation directory path correctly(don't include bin and don't include any slashes at the end of the path).
(At the time of writing this article i am using apache-maven-3.3.3)
Want to know how to resolve this..........I will explain you how to resolve this.
1.Go to the unzipped directory of maven-> then go to bin directory
2.you will find a batch file named "mvn" in the bin directory
3.Open the batch file in notepad or any text editor
4.Have a look at the code that is selected in the pic.
5.Usually we will include "bin" folder", but to use maven there is no need of including the bin directory of java in the path.
6.All you need to do is just enter the java installation directory.
7.Here in my system it is installed in "K:\Program Files\Java\jdk1.7.0_07" (no need of including the "bin" folder)
8.There is no need of including any slash at the end.........
You can verify the path you eneterd is correct or not.
as you can see in the code(mvn batch file)
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto chkMHome
%JAVA_HOME% -> just gives the path of the installation directory
/,bin ,java.exe ...everything are there itself in the code.
so if you run the command in cmd " echo %JAVA_HOME%\bin\java.exe" (don't include quotes) then you can know if there is anything wrong in the path(it has to show the correct path). If it shows correctly then path entered in JAVA_HOME is correct
You can test in command line (cmd) whether the java_home path points to correct Java installation directory or not
look at the pic below...........
(you can see any value of the environment variable using echo command in cmd)
Note: once if you change any environment variable in windows, please make sure not to check it in the existing opening window of cmd. Open a new cmd(command prompt window) and check the environment variable.
Command to see the value of any environment variable is echo <environmental variable>
example: echo %JAVA_HOME%
echo %path%
It's easy to resolve this.... all you have to do is enter the java installation directory path correctly(don't include bin and don't include any slashes at the end of the path).
(At the time of writing this article i am using apache-maven-3.3.3)
Want to know how to resolve this..........I will explain you how to resolve this.
1.Go to the unzipped directory of maven-> then go to bin directory
![]() |
Maven bin directory |
2.you will find a batch file named "mvn" in the bin directory
3.Open the batch file in notepad or any text editor
4.Have a look at the code that is selected in the pic.
6.All you need to do is just enter the java installation directory.
7.Here in my system it is installed in "K:\Program Files\Java\jdk1.7.0_07" (no need of including the "bin" folder)
You can verify the path you eneterd is correct or not.
as you can see in the code(mvn batch file)
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto chkMHome
%JAVA_HOME% -> just gives the path of the installation directory
/,bin ,java.exe ...everything are there itself in the code.
so if you run the command in cmd " echo %JAVA_HOME%\bin\java.exe" (don't include quotes) then you can know if there is anything wrong in the path(it has to show the correct path). If it shows correctly then path entered in JAVA_HOME is correct
You can test in command line (cmd) whether the java_home path points to correct Java installation directory or not
look at the pic below...........
(you can see any value of the environment variable using echo command in cmd)
Note: once if you change any environment variable in windows, please make sure not to check it in the existing opening window of cmd. Open a new cmd(command prompt window) and check the environment variable.
Command to see the value of any environment variable is echo <environmental variable>
example: echo %JAVA_HOME%
echo %path%
No comments:
Post a Comment