title: Issue accessing my jks keystore in Java
body: <p>I'm trying to test a HTTPS SSL connection from my local machine as I'm facing some issues implementing the same in my server.</p>
  
  <p>Steps I followed</p>
  
  <ol>
  <li><p>I downloaded the third party HTTPS server SSL certificate from the browser (DER format) and I see its issued by Comodo RSA</p></li>
  <li><p>I tried to import the key as .jks with the command from the command prompt, but it failed with the error 'certificate.jks file not found'/
      keytool -importcert -alias testCert -file c:\desktop\testCert.cer -keystore "C:\Program Files\Java\jre1.6.0\lib\security\certificate.jks" -storepass changeit</p></li>
  <li><p>So I googled and created the keystore with the command</p>
  
  <p>keytool -genkey -alias mykey -keystore "C:\Program Files\Java\jre1.6.0\lib\security\certificate.jks" </p></li>
  <li><p>And now I executed the same command (step 2), which ran successfully. I could even list and see the certificate in certificate.jks file.</p></li>
  <li><p>But when I try to access the certificate.jks in my java program as the keystore, it fails with the error 'file not found - certificate.jks'. </p>
  
  <pre><code>    KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
      ks.load(new FileInputStream ("C:/Program Files/Java/jre1.6.0/lib/security/certificate.jks"), passw );
  </code></pre></li>
  </ol>
  
  <p>Please clarify what am I doing wrong here. </p>
  
  <p>Also, I'm trying not to use cacerts since it gets refreshed automatically in my server. And I beleive if I create my own .jks, it won't get refereshed. Please help.</p>
  
  <p>Thanks</p>