How can I find and run the keytool
Question
I am reading an development guide of Facebook Developers at here
It says that I must use keytool to export the signature for my app such as:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
I do not know how to find the keytool in order to run it. I tried to open a Windows command prompt and paste the above command, but it did not work.
Accepted Answer
I found a solution by myself as below quote. It works fine.
"C:\Program Files\Java\jdk1.6.0_26\bin\keytool.exe" -exportcert -alias
> sociallisting -keystore "D:\keystore\SocialListing" |
> "C:\cygwin\bin\openssl.exe" sha1 -binary | "C:\cygwin\bin\openssl.exe"
> base64
Popular Answer
Simply enter these into Windows command prompt.
cd C:\Program Files\Java\jdk1.7.0_09\bin
keytool -exportcert -alias androiddebugkey -keystore "C:\Users\userName\.android\debug.keystore" -list -v
The base password is android
You will be presented with the MD5
, SHA1
, and SHA256
keys; Choose the one you need.
Read more... Read less...
To get android key hash code follow these steps (for facebook apps)
- Download the openssl for windows here
- now unzip to c drive
- open cmd prompt
- type
cd C:\Program Files\Java\jdk1.6.0_26\bin
- then type only
keytool -export -alias myAlias -keystore C:\Users\<your user name>\.android\myKeyStore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
- Done
To get Certificate fingerprint(MD5) code follow these steps
- go to - C:\Program Files\Java\jdk1.6.0_26\bin
- inside the bin folder run the
jarsigner.exe
file - open cmd prompt
- type
cd C:\Program Files\Java\jdk1.6.0_26\bin
- then again type on cmd
keytool -list -keystore "C:/Documents and Settings/<your user name>/.android/debug.keystore"
- it will ask for Keystore password now. The default is "
android
" type and enter - Done.
keytool is part of the JDK.
Try to prepend %{JAVA_HOME}\
to the exec statement or c:\{path to jdk}\bin
.
The KeyTool is part of the JDK. You'll find it, assuming you installed the JDK with default settings, in $JAVA_HOME/bin
Robby Pond
's answer can be generalized to use JAVA_HOME
environment variable and to also compensate for any blanks that might occur in the path (like Program Files
):
"%JAVA_HOME%\bin\keytool" -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64