在C:\ Program Files \ Java \ jdk1.8.0_191 \ bin中运行1-powersell
keytool.exe存在
2次运行
keytool -genkey -v -keystore版本-key.keystore -alias key-alias -keyalg RSA -keysize 2048-有效性10000
但显示此错误:
keytool : The term 'keytool' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ keytool -genkey -v -keystore d:\release-key.keystore -alias key-alias ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (keytool:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
建议[3,常规]:找不到命令键盘工具,但是它存在于当前位置。 Windows PowerShell默认情况下不会从当前位置加载命令。如果您信任此命令,请键入:“。\ keytool”。有关更多详细信息,请参见“获得关于about_Command_Precedence的帮助”。
答案 0 :(得分:1)
可以有两种解决方法,
您需要在系统环境的路径变量中设置 Java \ jdk1.8.0_191 \ bin 路径
编辑
实际上keytool位于jre文件夹中,而不位于jdk中。
所以检查一下
并确保在使用第一种解决方案时,使用.\keytool.exe
代替keytool