0

I'm trying to set up a project in my new laptop. While doing so, I faced this error even though the JAVA_HOME variable is set correctly.

Error:

C:\WINDOWS\system32>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

Environmental Variables in laptop:

Environmental Variables

Solutions tried so far:

  1. Almost all answers suggest declaring the JAVA_HOME variable correctly, which I have already done.
  2. Ensured 'bin' is not added in JAVA_HOME variable.
  3. Tried declaring JAVA_HOME via UI and via command prompt.
  4. Restarted my laptop multiple times.

Any possible solution is appreciated.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
justcurious
  • 839
  • 3
  • 12
  • 29
  • 2
    Remove the `;` at the end of your `JAVA_HOME` variable, it should only contain the directory. Voting to close as typo. – Mark Rotteveel Jan 14 '22 at 07:10
  • This might help other people if they encounter they same issue or a typo. If not, let me know, I can delete this. – justcurious Jan 14 '22 at 07:21
  • In general, typo issues are not considered worthy to keep as they are either very localized, or almost impossible to find through search. – Mark Rotteveel Jan 14 '22 at 07:23

1 Answers1

0

As Mark Rotteveel mentioned, removing the semi colon at the end fixed the error. I'm able to run maven commands now.

justcurious
  • 839
  • 3
  • 12
  • 29