echo %JAVA_HOME%C:\Program Files\Java\jdk1.8.0_91\;Error (Command line)C:\Users\admin>mvn -versio">

What do I do if I receive the error java_home is not defined correctly?

705    Asked by AngelaBaker in Java , Asked on Oct 13, 2022
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 Ava Black

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

Your Answer

Interviews

Parent Categories