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

What I should do if received - error java_home is not defined correctly?

308    Asked by Amitraj in Java , Asked on Oct 12, 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 Amit raj

Get rid of the trailing backslash and especially the trailing semi-colon to deal with error java_home is not defined correctly -


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