I'm trying to set up a project in my new laptop. While doing so, I faced this error even though the JAVA_HOME variable is set correctly.
Error:
C:\WINDOWS\system32>mvn -version
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
Environmental Variables in laptop:
Solutions tried so far:
- Almost all answers suggest declaring the JAVA_HOME variable correctly, which I have already done.
- Ensured 'bin' is not added in JAVA_HOME variable.
- Tried declaring JAVA_HOME via UI and via command prompt.
- Restarted my laptop multiple times.
Any possible solution is appreciated.