Open a console/command prompt (in admin mode if on windows), ‘cd’ to your JDK’s bin directory (if you do not have the JDK’s bin setup in your PATH) and run following command:
NOTE – Following command was named -export in previous releases. This old name is still supported in this release and will be supported in future releases, but for clarify the new name, -exportcert, is preferred going forward.
Once you run above command, it will create a new file (if not already exists) at following location:
Windows : %JAVA_HOME%\bin\test-key.cer
Linux/Mac/Solaris : $Java_HOME/bin/test-key.cer
When you open the certificate file in notepad or any other plain text editor, it will look like: