keytool error bash: keytool: command not found keytool error bash: keytool: command not found java java

keytool error bash: keytool: command not found


These are the steps which solved my problem:

  • Search the path where my java was installed

    find / -name jre
  • Move to java directory (where jre was installed on my server)

    cd /path/to/jre/bin
  • Create SSL certificate with keytool command

    ./keytool -genkey -alias [mypassword] -keyalg [RSA]


Use

./keytool -genkey -alias mypassword -keyalg RSA


Ensure jre is installed.

cd /path/to/jre/bin/folder

As keytool file is present in the bin folder of jre, give path till bin as in the command above.

Then you can do:

keytool -genkey -alias aliaskeyname -keyalg RSA -keystore C:\mykeystore

The additional option -keystore will help you to specify the path where you want the generated self signed certificate.