Search code examples
javatomcatsslcertificatekeytool

keytool error bash: keytool: command not found


I have tried to execute keytool from Java bin directory but I get an error with warning bash: keytool: command not found.

root@xxxxxx]# keytool -genkey -alias mypassword -keyalg RSA

bash: keytools: command not found

Solution

  • 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]