Importing the certificate to the Java certificate Keystore

To import the certificate into your Java certificate keystore, follow the steps below:

  1. Open the console.

  2. Set the JAVA_HOME variable and the PATH variable.

  3. Navigate to the $JAVA_HOME/lib/security folder and run the following command:
    keytool -import -alias <aliasname> -keystore cacerts -file <generated certificate path>
    For the alias, use any name.
    For the file, specify the path of the exported certificate, including the file name.

  4. You are now asked to enter the password. Enter your Java keystore password (the default password is changeit).

  5. Type yes, to confirm that you trust this certificate.

    The certificate is saved successfully.