Maven Java Home Configuration
I installed the JDK and configured Maven. The call mvn -version i get
returns:
The JAVA_HOME environment variable is not defined correctly. This environment variable is required to run this program. NB: JAVA_HOME must point to JDK, not JRE
$JAVA_HOME
the variable is set to C:\Program Files\Java\jdk1.8.0_131\bin
in the system variables.
The call %JAVA_HOME%
returns the path C:\Program Files\Java\jdk1.8.0_131\bin
.
Where is the problem?
source to share
As you can see in the documentation , the variable JAVA_HOME
should point to the java install path, not the folder bin
.
Change it to C:\Program Files\Java\jdk1.8.0_131
source to share
The question is about Windows, but I came here trying to solve the problem on Ubuntu. I faced a similar problem. I configured $JAVA_HOME
in /etc/environment
for example$JAVA_HOME=PATH_TO_JDK
$JAVA_HOME=/home/max/jdk1.8.0_144
Carefully with
- Space after path declaration
$JAVA_HOME=/home/max/jdk1.8.0_144[[_NO_WHITE_SPACE_AFTER_DECLARATION]]
- Don't add a double apostrophe
$JAVA_HOME="/home/max/jdk1.8.0_144"
- Don't put / bin eg
$JAVA_HOME=/home/max/jdk1.8.0_144/bin
<- This is wrong.
source to share