How can I find and run the keytool

2019-01-02 14:25发布

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.

15条回答
只靠听说
2楼-- · 2019-01-02 15:03

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
查看更多
伤终究还是伤i
3楼-- · 2019-01-02 15:04

The KeyTool is part of the JDK. You'll find it, assuming you installed the JDK with default settings, in $JAVA_HOME/bin

查看更多
回忆,回不去的记忆
4楼-- · 2019-01-02 15:05

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.

查看更多
初与友歌
5楼-- · 2019-01-02 15:08

Depending on your version of Eclipse ( I am using Kepler). Go to Windows> Preferences>Android> Build.

You'll find the location path of your debug keystore as well as the SHA1 fingerprint (which you can just copy and use)

查看更多
路过你的时光
6楼-- · 2019-01-02 15:09

On cmd window (need to run as Administrator),

cd %JAVA_HOME% 

only works if you have set up your system environment variable JAVA_HOME . To set up your system variable for your path, you can do this

setx %JAVA_HOME% C:\Java\jdk1.8.0_121\

Then, you can type

cd c:\Java\jdk1.8.0_121\bin

or

cd %JAVA_HOME%\bin

Then, execute any commands provided by JAVA jdk's, such as

keytool -genkey -v -keystore myapp.keystore -alias myapp

You just have to answer the questions (equivalent to typing the values on cmd line) after hitting enter! The key would be generated

查看更多
与风俱净
7楼-- · 2019-01-02 15:12

Keytool is part of the Java SDK. You should be able to find it in your Java SDK directory e.g. C:\Program Files\Java\jdk1.6.0_14\bin

查看更多
登录 后发表回答