keytool is not recognized as a command when trying to obtain key

16,410

Solution 1

It looks like your %PATH% - OS environment variable is not configured properly.

You can either:

Call keytool by specifying full path to your <Java_Home>/bin/keytool.exe executable file.
For me, the path looks like this:
"c:\Program Files (x86)\Java\jdk1.6.0_20\bin\keytool.exe"

Or,

Correct your %Path% variable; by appending %JAVA_HOME%\bin to it.

Solution 2

"c:\Program Files(x86)\Java\jdk1.7.0\bin\keytool.exe" -list -v -alias androiddebugkey -keystore "C:\Users\EIS\.android\debug.keystore" -storepass android -keypass android

Then hit the "Enter" key and your MD5 and SHA1 will show.

Share:
16,410
Sam Bevins
Author by

Sam Bevins

Intern at the Air Force Research Lab (AFRL) in Dayton, Ohio.

Updated on June 04, 2022

Comments

  • Sam Bevins
    Sam Bevins almost 2 years

    I am setting up a google maps activity and I am trying to get my API key. However in my cmd I get the error that keytool is not recognized as an internal or external command....ect.... I tried using the solution posted in a similar question but it didn't work for me.

    My Default dubug keystore

    C:\Users\Sam\.android\debug.keystore
    
  • Sam Bevins
    Sam Bevins over 11 years
    how do i find mine then? I found what is above by going in to the properties in eclipse
  • Tomislav Novoselec
    Tomislav Novoselec over 11 years
    look in the folder where you've installed Java
  • Sam Bevins
    Sam Bevins over 11 years
    I tried but it says now when I use CMD that The system cannot find the file specified
  • Sam Bevins
    Sam Bevins over 11 years
    keytool -list -alias androiddebugkey \ -keystore <C:\Program Files\Java\jre7\bin>.keystore \ -storepass android -keypass android
  • Tomislav Novoselec
    Tomislav Novoselec over 11 years
    position yourself in .android folder and execute this: "C:\Program Files\Java\jre7\bin\keytool.exe" -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android -v
  • Sam Bevins
    Sam Bevins over 11 years
    I used that in cmd because I'm not sure what you mean by positioning myself in the android folder. But when I ran it in cmd I got a java.lang.exception
  • Tomislav Novoselec
    Tomislav Novoselec over 11 years
    do you even know how to navigate through your filesystem via cmd? "C:\Program Files\Java\jre7\bin\keytool.exe" -list -alias androiddebugkey -keystore "C:\Users\Sam\.android\debug.keystore" -storepass android -keypass android -v