What should I do if I receive this message - Maven Installation Error JAVA_HOME not defined correctly?

Operating System Windows 10 java version "1.8.0_161" - jre

C:Usersadmin>echo %JAVA_HOME%

C:Program FilesJavajdk1.8.0_91; Error (Command line) C:Usersadmin>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

Answered by ananya Pawar

I had the same issue - error JAVA_HOME not defined correctly. Please remove the backslash('') and semicolon.

For windows 10, here are the steps:
Open Environment Variables
Select 'JAVA_HOME' under system variables
Click Edit
Remove the ; from the path under the 'variable name'.
Click 'OK'
Done. RUN the mvn -version command and it shall work.

Your Answer


Parent Categories