title: programmatically import .cer certificate into keystore
body: <p>How can I import a .p12 certificate from the classpath into the java keystore? First I used the InstallCert <a href="https://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java" rel="noreferrer">https://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java</a> and did some changes so the server certificate will be imported into the keystore in the java install directory. This works fine but now I want to load a certificate from my classpath.</p>
  
  <p>EDIT: I just use a .cer certificate, see next answer</p>