To convert a certificate in PEM format and a private key to JKS (Java KeyStore) format, you can follow these steps
Convert the private key to PKCS12 format
$openssl pkcs12 -export -out xyz.p12 -inkey private.key -in xyz.pem
Replace privatekey.pem with the path to your private key file and certificate.pem with the path to your certificate file. You will be prompted to set a password for the PKCS12 file
Use the keytool utility provided by Java to convert the PKCS12 file to JKS format
$keytool -importkeystore -srckeystore xyz.p12 -srcstoretype pkcs12 -destkeystore xyz.jks -deststoretype jks
You can use the keytool utility to view the contents of the JKS file and verify the conversion. Run the following command
$keytool -list -keystore xyz.jks