Add Let's encrypt certificate to Java keystore

Let’s encrypt places certificates in the following directory:

/etc/letsencrypt/live/YOUR-DOMAIN-NAME/

The first thing you’ll have to do is convert your certificate to .der format

openssl x509 -outform der -in cert.pem -out cert.der

The to import the certificate run this command:

keytool -import -alias your-alias -keystore cacerts -file cert.der

If you would like to import your certificate into the keystore with .pem format:

keytool -import -alias *alias* -keystore cacerts -file *cert.pem*