keytool error bash: keytool: command not found

user217929 picture user217929 · May 2, 2013 · Viewed 170.7k times · Source

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

Answer

user217929 picture user217929 · Jun 10, 2013

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]