Programmers learn & share
0 votes
44 views

Problem :

When ever I run mvn --version command from inside the bin it gives me the version but when I run it from the outside of bin it gives following exception :

'mvn' is not recognized as an internal or external command, operable program or batch file.

by (6.9k points)   | 44 views

2 Answers

0 votes

Solution :

To solve the issue please perform following steps:

Firstly do right click on My Computer >> Properties >> Advanced system settings >> System Properties >> Under Advanced >> Environment Variables

Now click on New to set Environment Variables as below

Variable name: JAVA_HOME 

Variable value: C:\Program Files\Java\jdk1.8.0_121

Variable name: M2 

Variable value: %M2_HOME%\bin

Variable name: M2_HOME 

Variable value: C:\Program Files\Apache Software Foundation\apache-maven-3.5.0

Variable name: Path 

Variable value: %M2_HOME%\bin

After that please click on Ok.Now you need to restart your command prompt and check again with “mvn –version” to verify that the mvn is running.

It will Work Enjoy :)

by (36.1k points)  
0 votes

This the most commonly used error that occurs with the command prompt. As the error itself suggests that it could not recognize the tool you are trying to use with the command prompt.

Reasons for this error:

  • One of the most common reasons that your PC has installed another app that modified tour system variables.
  • The second reason is that you don’t have installed an appropriate program on your computer.

Fixing error in windows:

You can fix your error by using any of the following methods.

  • For solving this error, first, ensure that the program actually exists on your PC. Sometimes you may have a fake installer that told that the program was successfully installed on your computer, but actually it is not.
  • Use the full path to the executable files and it should be able to run it without any issues.
  • Enclose the file path with double-quotes. If the executable file contains many spaces, then it is going to cause an error.
  • Copy executable file along with all other associated files to the folder System32 on your computer.
  • Add all executable files to the environment variable. By adding files there you can tell the command prompt where a certain file is located and you can use it by its short name in CMD window.

 

by (3.2k points)  
2,245 questions
2,807 answers
60 comments
241 users