Search code examples
javassl-certificatetls1.2tomcat9

How to Generate & Install SSL/TLS certificates in my tomcat?


I am trying to run my apache tomcat 9 run in secure mode (https instead of http) by following guidelines provided by apache.

https://tomcat.apache.org/tomcat-8.0-doc/ssl-howto.html

But I am getting error message as C:\Program Files\AdoptOpenJDK\jdk-8.0.212.04-hotspot\bin\bin\keytool is not recognized as an internal or external command, operable program or batch file." when I tried to execute command "%JAVA_HOME%\bin\keytool" -genkey -alias tomcat -keyalg RSA

I have my java installed and the path is also set.

C:\Users>echo %JAVA_HOME%
C:\Program Files\AdoptOpenJDK\jdk-8.0.212.04-hotspot\bin

In above guideline since it is said as "%JAVA_HOME%\bin\keytool", I have created bin\keytool folder inside my Java_home path (C:\Program Files\AdoptOpenJDK\jdk-8.0.212.04-hotspot\bin)

Where have I gone wrong?


Solution

  • keytool is a program - not a folder. Another question about keytool that explains more what it is. I think your problem here is that JAVA_HOME should be the root folder of your java installation. In the bin directory you hopefully have the keytool binary. I don't believe there should be a bin/bin directory. It doesn't make much sense.