title: Programmatically Import CA trust cert into existing keystore file without using keytool
body: <p>I would like to create a JAVA program that import the .cer CA into the existing keystore file.
  So that end-user can insert the CA cert more convenience(without using CMD and key in the command).</p>
  
  <p>Is that anywhere that JAVA code can do this?</p>
  
  <p>i try some way, but still fail in getting the cert into java</p>
  
  <pre><code>CertificateFactory cf = CertificateFactory.getInstance("X.509");
  InputStream certstream = fullStream (certfile);
  Certificate certs = cf.generateCertificates(certstream);
  </code></pre>
  
  <p>the error is incompatible types, is there any other suggestion?</p>
  
  <p>Thanks Lot</p>