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

627    Asked by Ankesh Kumar in Cyber Security , Asked on Feb 11, 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 ananya Pawar

If error java_home is not defined correctly, you need to 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