What do I do if I receive the error java_home is 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
To remove the error java_home is not defined correctly -
Get rid of the trailing backslash and especially the trailing semicolon:
C:Program FilesJavajdk1.8.0_91
By the way, you can display the current setting with the shorthand of typing "set" at a command prompt followed by the minimal number of characters needed, i.e. on my system:
set j
JAVA_HOME=C:Program FilesJavajdk1.8.0_144