0

enter image description here

Tried all the steps provided in Maven JAVA_HOME environment variable is not defined correctly, but it is

Tried by pointing jdk to 1.8 version, issue still exist enter image description here when we run java version in cmd after pointing to 1.8, it's giving version 15

Progman
  • 16,827
  • 6
  • 33
  • 48
  • You have to restart your `cmd` when you have set the `JAVA_HOME` environment variable. Your current session will not get any changes in the variables list after it was started. – Progman Aug 28 '21 at 20:57
  • Have done that as well, still having issue – Annapoorna Ampu Aug 29 '21 at 06:41
  • 2
    The `JAVA_HOME` directory must point to the directory where you have installed the JDK. You are showing a java version 15, but you are pointing to a directory for java 1.8, which doesn't make sense. Please [edit] your question to include the output of `echo %PATH%`. Check the path where it points to the `bin/` directory of your java installation and edit your `JAVA_HOME` variable to point to the same directory without the `bin/` part. – Progman Aug 29 '21 at 07:12
  • Also ... please don't show us images of the output. Copy and paste the actual output into your question AS TEXT and format. Read: [please do not upload images of code/errors when asking a question.](//meta.stackoverflow.com/q/285551) – Stephen C Aug 29 '21 at 07:49

1 Answers1

0

In IntelliJ IDEA go to File>Project Structure>SDK>JDK home path. Copy it and then go to My Computer>Advanced Settings>Environment Variables Change the JAVA_HOME path to what you have copied. Then open new cmd, and try mvn -v

This solution worked enter image description here

  • Please don't show us images of the output. Copy and paste the actual output into your answer AS TEXT and format. – Stephen C Aug 29 '21 at 07:52
  • So ... basically ... your answer is to set JAVA_HOME correctly. Which is exactly what https://stackoverflow.com/questions/60086303 says. – Stephen C Aug 29 '21 at 07:55