How to Configure Maven/Java Environment Variables

Asked

Viewed 6,518 times

1

I have set the following environment variables

JAVA_HOME C:\Program Files\Java\jdk1.8.0_144%MAVEN%

MAVEN_HOME C:\Users\Rafael Storm\Desktop\apache-maven-3.5.2 - (extrai o Maven)

MAVEN %MAVEN_HOME%\bin

Path %JAVA_HOME%\bin

However, when I try to check on Maven...

C:\Users\Rafael Storm>mvn -version
'mvn' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.

Any hint or variable that might be set wrong?

  • This wrong config, removes from JAVA_HOME that %MAVEN%, creates a M2_HOME and points to the Maven folder then in the path uses Path %JAVA_HOME% bin;%M2_HOME% bin

  • Remembering that as it is windows any config is not valid for the current DOS window, after configured need to close and open a new.

2 answers

2

You didn’t detail exactly as he did, to understand where his mistake might have been. But process, in Windows, can be this below.

Once with Maven downloaded and uncompressed in some directory:

  1. Press the Windows key on the keyboard and type: "edit system variables". Clicking in the option that appears.
  2. On the "Environment Variables" screen that will open, click on the "New" button just below the part of the screen that says "System Variables".
  3. In the variable name and value fields, fill in: MAVEN_HOME and C:\Users\Rafael Storm\Desktop\apache-maven-3.5.2, respectively. Confirm.
  4. Again in "System Variables", search for by the variable PATH and click in editing.
  5. On the "Edit System Variable" screen, click the "New" button and add %MAVEN_HOME%\bin.
  6. Confirm all screens until you leave all screens.

If you have an open command prompt, close it and open it again. The following command should work:

mvn -version

0

In the variable MAVEN_HOME it is necessary to inform the path to the BIN folder ie: C: Users Rafael Storm Desktop apache-Maven-3.5.2 bin and if necessary add this path to Path as well.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.