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

0 votes

Maybe the question was asked before but I found a very strange kind of error. When I run mvn --version command from bin it gives the version and the other information. However when I run outside the bin it gives an exception. Both the result mention below

C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5\bin>mvn --version 
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21: 
28+0530) 

Maven home: C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5 
Java version: 1.7.0_25, vendor: Oracle Corporation 
Java home: C:\Program Files\Java\jdk1.7.0_25\jre 
Default locale: en_US, platform encoding: Cp1252 
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows" 

C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5>mvn --version 
'mvn' is not recognized as an internal or external command, 
operable program or batch file.

Also I set JAVA_HOME in the user variable and M2_HOME, M2 in the system environment variable. The output for these variables and %path% is:

C:\Users\SAHILBHALLA>echo %JAVA_HOME% 
C:\Program Files\Java\jdk1.7.0_25 

C:\Users\SAHILBHALLA>echo %M2% 
C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5\bin 

C:\Users\SAHILBHALLA>echo %M2_HOME% 
C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5 

C:\Users\SAHILBHALLA>echo %path% 
C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPow erShell\v1.0\;C:\Program Files\Java\jdk1.7.0_25\bin;.;

Tell me where I am wrong. What should I do to recover from it?

Feb 17, 2022 in Java by Rahul
• 9,680 points
1,238 views

1 answer to this question.

0 votes

 While I was solving this problem, the path didn't resolve %M2%. When i added the location of maven-bin in the path instead of %M2% after that commands worked.

answered Feb 17, 2022 by Aditya
• 7,680 points

Related Questions In Java

0 votes
1 answer

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

Hey @Paridhi, check this out https://www.edureka.co/community/4800/unable-resolve-error-recognized-internal-external-command This should solve ...READ MORE

answered Apr 20, 2020 in Java by Sirajul
• 59,230 points
1,750 views
+9 votes
16 answers

Unable to resolve this error: "javac is not recognized as an internal or external command"

Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1.7.0_02\bin and ...READ MORE

answered May 23, 2018 in Java by Rishabh
• 3,620 points
463,201 views
0 votes
1 answer

Is it possible to run a java program from command line on windows?How?

  Let's say your file is in C:\myprogram\ Run ...READ MORE

answered Apr 18, 2018 in Java by sophia
• 1,400 points
2,639 views
+5 votes
4 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,450 points

edited Nov 7, 2018 by Omkar 81,083 views
+1 vote
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points
8,303 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,500 points
17,379 views
0 votes
1 answer

Selenium JARS(Java) missing from downloadable link

Nothing to worry about here. In the ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,500 points

edited Aug 4, 2023 by Khan Sarfaraz 4,804 views
0 votes
1 answer

nodemon command is not recognized in terminal for node js server

You need to install it globally npm install ...READ MORE

answered Feb 17, 2022 in Java by Aditya
• 7,680 points
8,563 views
0 votes
1 answer

jQuery fix for "Uncaught TypeError: $ is not a function" error

 Use the following lines of code in ...READ MORE

answered Feb 16, 2022 in Java by Aditya
• 7,680 points
2,082 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP