Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find and run the keytool

People also ask

Where is Keytool located?

keytool is a tool to manage (public/private) security keys and certificates and store them in a Java KeyStore file (stored_file_name. jks). It is provided with any standard JDK / JRE distributions. You can find it under the following folder %JAVA_HOME%\bin .

How do I get Keytool to work?

Add the keytool folder to your system PATH (on Windows) In order to run keytool from the command line, you need to add it to your system PATH. This step is required on Windows only, as keytool will is automatically installed on /usr/bin on macOS/Linux.


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

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.


To get android key hash code follow these steps (for facebook apps)

  1. Download the openssl for windows here
  2. now unzip to c drive
  3. open cmd prompt
  4. type cd C:\Program Files\Java\jdk1.6.0_26\bin
  5. 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
  6. Done

To get Certificate fingerprint(MD5) code follow these steps

  1. go to - C:\Program Files\Java\jdk1.6.0_26\bin
  2. inside the bin folder run the jarsigner.exe file
  3. open cmd prompt
  4. type cd C:\Program Files\Java\jdk1.6.0_26\bin
  5. then again type on cmd keytool -list -keystore "C:/Documents and Settings/<your user name>/.android/debug.keystore"
  6. it will ask for Keystore password now. The default is "android" type and enter
  7. Done.

keytool is part of the JDK.

Try to prepend %{JAVA_HOME}\ to the exec statement or c:\{path to jdk}\bin.


I found this on another post, which did not get many upvotes, but it was super helpful for me. So will add it here.

Android Studio will bring a keytool with it.

C:\Program Files\Android\Android Studio\jre\bin

You can see his post below by Richar Heap, with a helpful reference. I did see this before but forgot about it. https://stackoverflow.com/a/51524526/4446406


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