3
votes

1-Run powersell in C:\Program Files\Java\jdk1.8.0_191\bin

keytool.exe exist

2-run

keytool -genkey -v -keystore release-key.keystore -alias key-alias -keyalg RSA -keysize 2048 -validity 10000

but show this error:

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

Suggestion [3,General]: The command keytool was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\keytool". See "get-help about_Command_Precedence" for more details.

1

1 Answers

2
votes

There can be two solutions,

  1. Go to Java\jdk1.8.0_191\bin dir and open cmd or powershell there and run your command
  2. You need to set Java\jdk1.8.0_191\bin path in your system environment's path variable

    EDIT

actually keytool resides in jre folder not in jdk.

so check this,

  1. Go to Java\jre1.8.0_191\bin dir and open cmd or powershell there and run your command
    1. You need to set Java\jre1.8.0_191\bin path in your system environment's path variable

and make sure when you use first solution use .\keytool.exe instead of keytool