Results 1 to 10 of 10
Like Tree2Likes
  • 2 Post By Solomon

Thread: Maven: 'cmd' is not recognised as an internal or external command

  1. #1
    sibernewf is offline Member
    Join Date
    Mar 2011
    Posts
    48
    Rep Power
    0

    Default Maven: 'cmd' is not recognised as an internal or external command

    Hi all,

    I've been playing with Maven and a strange issue has appeared.

    I'm using Windows Vista 32 bit.

    Below are the steps I went through to setup Java and Maven (Please note I previously setup Maven 3.0.3 - and had the same problem-so removed it and decided to try maven 2.2.1)

    1. I installed java 1.6.0_29 to: C:\Program Files\Java\jdk1.6.0_29
    2. I installed maven 2.2.1 to: C:\apache-maven-2.2.1
    3. I created a JAVA_HOME environment variable to: C:\Program Files\Java\jdk1.6.0_29
    4. I created a M2 environment variable to: %M2_HOME%\bin
    5. I created a M2_HOME environment variable to: C:\apache-maven-2.2.1
    6. I updated my Path system variable with: C:\apache-maven-2.2.1\bin;C:\Program Files\Java\jdk1.6.0_29\bin

    I use Netbeans 7.0.1

    now, the problem is, when I attempt to build an app in Netbeans it builds without errors (Build successful) but the last line reads: 'cmd' is not recognized as an internal or external command, operable program or batch file.

    The same occurs in Netbeans when I run the app, but the application fails to open (its a webapp).

    When I try to run the app using DOS and mvn package, etc. I still get the same message.

    Anyone have any ideas what is going on? Its driving me nuts.

    Cheers

    Al

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    Can you copy and paste here the full text from when you try to execute the program in a command prompt?
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  3. #3
    sibernewf is offline Member
    Join Date
    Mar 2011
    Posts
    48
    Rep Power
    0

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    Ok, when I type: javac -version, the following appears:

    C:\Als Stuff\myjavasource\mavenproject1>javac -version
    javac 1.6.0_29

    C:\Als Stuff\myjavasource\mavenproject1>


    Next when I type mvn --version the following happens:


    C:\Als Stuff\myjavasource\mavenproject1>mvn --version
    Apache Maven 2.2.1 (r801777; 2009-08-07 05:16:01+1000)
    Java version: 1.6.0_29
    Java home: C:\Program Files\Java\jdk1.6.0_29\jre
    Default locale: en_AU, platform encoding: Cp1252
    OS name: "windows vista" version: "6.0" arch: "x86" Family: "windows"
    'cmd' is not recognized as an internal or external command,
    operable program or batch file.
    C:\Als Stuff\myjavasource\mavenproject1>

    So as you can see, the 'cmd' is not recognised.... doesnt happen when I run the java version. Anyone have any ideas?
    This is happening on both my laptop and my desktop PC at home. but at least the Desktop PC still runs the application, while the laptop just builds the app and does nothing else (doesnt open the browser).

  4. #4
    AvalancheBoy is offline Member
    Join Date
    Dec 2011
    Posts
    1
    Rep Power
    0

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    Add C:\Windows\System32 to your Path variable in environment variables and it should work.

  5. #5
    sibernewf is offline Member
    Join Date
    Mar 2011
    Posts
    48
    Rep Power
    0

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    Thanks AvalanceBoy,

    Ill give that a go when I am back home.

    Cheers

    Al

  6. #6
    sibernewf is offline Member
    Join Date
    Mar 2011
    Posts
    48
    Rep Power
    0

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    Ok, I've had a look and below is a copy/paste of my path variables (Ive formatted it to make it easier to read):

    Java Code:
    /%SystemRoot%\system32;
    %SystemRoot%;
    %SystemRoot%\System32\Wbem;
    C:\Program Files\CyberLink\Power2Go;
    C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;
    %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
    C:\Program Files\MySQL\MySQL Server 5.5\bin;
    C:\apache-maven-2.2.1\bin;
    C:\Program Files\Java\jdk1.6.0_29\bin
    Last edited by sibernewf; 12-11-2011 at 02:03 AM.

  7. #7
    sibernewf is offline Member
    Join Date
    Mar 2011
    Posts
    48
    Rep Power
    0

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    It appears I only get the:

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


    when running mvn commands. Any other MSDOS command doesnt reproduce it. So I suspect its related only to Maven.

  8. #8
    sibernewf is offline Member
    Join Date
    Mar 2011
    Posts
    48
    Rep Power
    0

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    Ok, I finally gave up and re-installed my Operating System on the laptop.
    The problem has gone away. But I have no idea what happened in the first place.

    Cheers

  9. #9
    er.raj is offline Member
    Join Date
    Mar 2012
    Posts
    15
    Rep Power
    0

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    Quote Originally Posted by AvalancheBoy View Post
    Add C:\Windows\System32 to your Path variable in environment variables and it should work.
    I was facing a similar issue and this worked for me.

  10. #10
    Solomon is offline Member
    Join Date
    Jun 2012
    Posts
    1
    Rep Power
    0

    Default Re: Maven: 'cmd' is not recognised as an internal or external command

    It happened to me also, but I managed to reedit the environment path of my computer to what it was before after adding the ANT and JAVA paths. hope it will fix your's also as the problem occurs because of the fact that CMD couldn't get to the system root.
    vickydgm and hemaraghavendra like this.

Similar Threads

  1. Replies: 12
    Last Post: 11-25-2010, 06:55 AM
  2. Replies: 6
    Last Post: 09-13-2010, 11:13 PM
  3. Replies: 5
    Last Post: 04-26-2010, 04:45 AM
  4. 'javac' is not recognized as an internal or external command
    By sam_1032002@btopenworld.c in forum New To Java
    Replies: 3
    Last Post: 10-18-2008, 02:40 AM
  5. Replies: 6
    Last Post: 07-30-2008, 03:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •