我正在这里阅读Facebook开发者的开发指南
它说,我必须使用keytool导出签名为我的应用程序,如:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
我不知道如何找到关键工具,以运行它。我试图打开Windows命令提示符并粘贴上述命令,但它不起作用。
我正在这里阅读Facebook开发者的开发指南
它说,我必须使用keytool导出签名为我的应用程序,如:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
我不知道如何找到关键工具,以运行它。我试图打开Windows命令提示符并粘贴上述命令,但它不起作用。
当前回答
keytool是jdk的一部分,它应该是$JAVA_HOME/bin/keytool
其他回答
keytool是jdk的一部分,它应该是$JAVA_HOME/bin/keytool
考虑添加PATH作为环境变量,并通过cmd访问它。
PATH作为值,C:\Program Files\Java\ jre1.8.0_331\bin作为变量,并通过keytool访问它…
我自己找到了一个解决方案,如下所示。它工作得很好。
"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
你也可以这样做:
将bat文件复制到PATH环境变量中已经存在的任何文件夹中 然后只需在任何Windows shell中使用keytool命令
keytool的实际位置在bat文件中定义。如果位置错误,bat文件将扫描您的系统,以检测ProgramFiles(子)文件夹中的潜在位置。
还可以找到keytool2.bat,这是"keytool -v -list -keystore"的便捷快捷方式,广泛用于快速检查jks文件的内容。
keytool.bat:
::
::
:: "keytool alias" script by Céphas
:: easy method : add the known keytool.exe folder to your personal PATH variable (run : C:\Windows\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables)
:: else, add the folder containing this bat script to your personal path or put this script in any folder already defined in your path
::
:: also see keytool2.bat that automatically adds the following parameters in the keytool command line : -v -list -keystore, for quick display of jks content
::
::
@echo off
set THIS_SCRIPT=%~f0
rem setlocal enableDelayedExpansion : necessary for paths containing special chars
setlocal enableDelayedExpansion
rem set PATH to keytool.exe ; path must include the final \
rem ^ is escape char for paths containing & \ < > ^ |
set PATH_TO=C:\Program Files\Java\jre1.8.0_45\bin\
set PROG_NAME=keytool.exe
rem full_path, with "", to work with paths containing special chars
set FULL_KT_PATH="!PATH_TO!!PROG_NAME!"
rem checks if keytool.exe exists
(dir %FULL_KT_PATH%>nul 2>nul && set KT_FOUND=yes) || set KT_FOUND=no
if %KT_FOUND%==yes (
rem keytool found => launching it with all supplied parameters
rem
rem
%FULL_KT_PATH% %*
rem
rem
) else (
rem keytool not found, trying to find it in %ProgramFiles%
echo.
echo Keytool not found in expected location, scan in progess ...
echo.
cd "%ProgramFiles(x86)%" 2>nul && dir /B /S keytool.exe 2>nul
cd "%ProgramFiles%" 2>nul && dir /B /S keytool.exe 2>nul
echo.
echo *********
echo Path to program keytool.exe not properly defined, or keytool/java missing on this system
echo If any location has been found during above scan, fix variable "PATH_TO" in %THIS_SCRIPT% accordingly
echo *********
echo.
pause
)
keytool2.bat:
::
::
:: "keytool2 alias" script by Céphas
:: easy method : add the known keytool.exe folder to your personal PATH variable (run : C:\Windows\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables)
:: else, add the folder containing this bat script to your personal path or put this script in any folder already defined in your path
::
:: keytool2 automatically adds the following parameters in the keytool command line : -v -list -keystore
:: thus, to quickly display the full content of a jks file, usage is simply : keytool2 \path\to\your\keystore.jks [-alias your_alias]
::
::
@echo off
set THIS_SCRIPT=%~f0
rem setlocal enableDelayedExpansion : necessary for paths containing special chars
setlocal enableDelayedExpansion
rem set PATH to keytool.exe ; path must include the final \
rem ^ is escape char for paths containing & \ < > ^ |
set PATH_TO=C:\Program Files\Java\jre1.8.0_45\bin\
set PROG_NAME=keytool.exe
rem full_path, with "", to work with paths containing special chars
set FULL_KT_PATH="!PATH_TO!!PROG_NAME!"
rem checks if keytool.exe exists
(dir %FULL_KT_PATH%>nul 2>nul && set KT_FOUND=yes) || set KT_FOUND=no
if %KT_FOUND%==yes (
rem keytool found => launching it with all supplied parameters
rem
rem
%FULL_KT_PATH% -v -list -keystore %*
rem
rem
) else (
rem keytool not found, trying to find it in %ProgramFiles%
echo.
echo Keytool not found in expected location, scan in progess ...
echo.
cd "%ProgramFiles(x86)%" 2>nul && dir /B /S keytool.exe 2>nul
cd "%ProgramFiles%" 2>nul && dir /B /S keytool.exe 2>nul
echo.
echo *********
echo Path to program keytool.exe not properly defined, or keytool/java missing on this system
echo If any location has been found during above scan, fix variable "PATH_TO" in %THIS_SCRIPT% accordingly
echo *********
echo.
pause
)
KeyTool是JDK的一部分。假设您使用默认设置安装了JDK,您将在$JAVA_HOME/bin中找到它