Creating JKS file

Generate a Java keystore and key pair

keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048

Generate a CSR for an existing Java keystore

keytool -certreq -alias mydomain -keystore keystore.jks -file CSR.csr

Import a root or intermediate CA certificate

keytool -import -trustcacerts -alias root -file CA.crt -keystore keystore.jks

Import a signed certificate

keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks

Generate a keystore and self-signed certificate

keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360