'keytool' is not recognized as an internal or external command

16,337

That happens because you haven't added the bin directory of your JAVA_HOME environment variable in your %PATH%.

  1. Add the environment variable JAVA_HOME with path C:\Program Files\Java\jdk1.8.0_131 without the bin directory.
  2. Add the %JAVA_HOME%\bin directory at the end of your %PATH%.
Share:
16,337
Thidasa Pankaja
Author by

Thidasa Pankaja

Passionate Software Engineer at Twire working towards achieving professional goals, with an active drive to learn new technologies. Skilled in JavaScript, React, Go, PostgreSQL etc. Strong engineering professional with a Bachelor of Science (Hons) focused in Information Technology from University of Moratuwa.

Updated on December 02, 2022

Comments

  • Thidasa Pankaja
    Thidasa Pankaja over 1 year

    I've created a small Android application using Ionic and I was going to build the signed apk to test the app.

    When I typed 'keytool' command in my command prompt I'm getting this error

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

    And I tried googling and all solved problems mentions that it's a problem with Path variable of JDK. I tried changing my 'JAVA_HOME' variable value to 'C:\Program Files\Java\jdk1.8.0_131\bin' and to 'C:\Program Files\Java\jre1.8.0_131\bin' and still getting the same error.

    But when I run the 'keytool' command it the cmd 'C:\Program Files\Java\jre1.8.0_131\bin' location, it works.

    Can anyone help me with this ? What might be a problem that I can't access it globally ?

    • Stephen C
      Stephen C almost 7 years
      The problem is that the bin directory is not on your %PATH%. The command shell (e.g. "cmd.exe") looks for commands in the search path given by %PATH%.
    • Thidasa Pankaja
      Thidasa Pankaja almost 7 years
      Thanks. But how to add the bin directory to %PATH% ?
  • Thidasa Pankaja
    Thidasa Pankaja almost 7 years
    Thanks. As you've mentioned I changed JAVA_HOME variable path to 'C:\Program Files\Java\jdk1.8.0_131' But I don't get the 2nd point
  • Giorgio Antonioli
    Giorgio Antonioli almost 7 years
    @ThidasaParanavitharana You have also a variable named Path. You can find inside it, some paths to executable. At the end of these paths, you have to add the last path with %JAVA_HOME%\bin
  • Thidasa Pankaja
    Thidasa Pankaja almost 7 years
    Thanks a lot. It worked
  • Giorgio Antonioli
    Giorgio Antonioli almost 7 years
    @ThidasaParanavitharana No problem. If it worked, mark the answer as accepted
  • Matias
    Matias almost 6 years
    Perfect explanation. Just what I needed. Thanks a lot!