From JAVA version 6, we can import PKCS certificate into java keystore.

1. First, we need to create an empty keystore.

Open command window and type:

keytool -genkey -alias foo -keystore testKeystore.jks

2. Enter data keytool asks you for.

3. Import .pfx into keystore you created using this command:

keytool -importkeystore -srckeystore keystore.pfx -srcstoretype pkcs12 -destkeystore testKeystore.jks -deststoretype JKS

4. Enter destination and source keystore password.

5. Check if all of your certificates from pfx are imported into JKS.

keytool -list testKeystore.jks

How to convert .pfx to JKS keystore using keytool?