Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keytool : The term 'keytool' is not recognized as the name of a cmdlet, function, script file, or operable program

Tags:

flutter

dart

trying to build release for android. I ran keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key in the vscode terminal but I get 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 ~/key.jks -keyalg RSA -keysize 2048 -val ...
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (keytool:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I ran flutter doctor -v and get thisJava binary at: C:\Program Files\Android\Android Studio\jre\bin\java use the path and replace java with keytool(as in the documentation) but still get error. what do I do

like image 924
Norbert Avatar asked Jan 27 '23 17:01

Norbert


1 Answers

Try running it from a normal Windows Command Prompt

D:\temp>"c:\Program Files\Android\Android Studio\jre\bin\keytool.exe" -help
Key and Certificate Management Tool

Commands:

 -certreq            Generates a certificate request
 -changealias        Changes an entry's alias
 -delete             Deletes an entry
 -exportcert         Exports certificate
...

Also, on Windows, you can't use ~/. Change that to a Windows style path like C:\Users\Norbert\keys, or wherever you want to keep the keystore.

like image 60
Richard Heap Avatar answered Jan 30 '23 06:01

Richard Heap