Reputation: 29
When I am running the command mvn -version in command prompt I am getting the following error: The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE
Please help me out why it is saying this. I have added JDK 11 in my Environment till Bin path
Upvotes: 0
Views: 27297
Reputation: 1
in my own case I extracted """java_17.zip"""" then I cobied the path like this
C:\Program Files\Java\jdk-17 to JAVA_HOME but it must be
=> C:\Program Files\Java\jdk-17\jdk-17.0.12*
I missed this part "jdk-17.0.12" from the path
Upvotes: 0
Reputation: 1
In my own case, I had two JDK's on my machine (18.1.1 & 19).
JDK 18.1.1 was the active path on the JAVA_HOME.
So, it made my JAVA_HOME looked like this.
C:\Program Files\Java\jdk 18.1.1.
Then, I just decided to change it to the highest version.
C:\Program Files\Java\jdk-19...
Boom!!! it worked....
You can try it out.
I hope it helps.
Upvotes: 0
Reputation: 1
JAVA_HOME must not have ";"
If JAVA_HOME be set to something like "C:\Program Files\Java\jdk1.8.0_333;" It will report an error "The JAVA_HOME environment variable is not defined correctly, this environment variable is needed to run this program."
JAVA_HOME should be set to something like "C:\Program Files\Java\jdk1.8.0_333"
Upvotes: 0
Reputation: 10329
Normally JAVA_HOME
does not contain the \bin
part of the path.
Your JAVA_HOME
should be set to something like C:\Program Files\Java\jdk-11.0.10
, and your PATH
should include something like %JAVA_HOME%\bin
.
Upvotes: 5
Reputation: 404
Please note:
bin
directory.I always set it to the 8.3-formatted name progra~1
of the "Program Files" directory. For example:
JAVA_HOME=C:\PROGRA~1\Java\jdk1.8.0_172\
Find the actual 8.3 name running: dir c:\ /x
Upvotes: 2