title: Keystore : The system cannot find the path specified
body: <p>I need to convert extension of ssl certificate from <code>.cer</code> to <code>.bks</code></p>
  
  <p>So, I followed this SO answer  </p>
  
  <p><a href="https://stackoverflow.com/questions/21284466/how-to-convert-cer-to-bks">How to convert .cer to BKS</a></p>
  
  <p>I am using <code>cmd</code></p>
  
  <p>This is my input command : </p>
  
  <pre><code>keytool -importcert -v -trustcacerts -file "C:\Users\alexey.t\Downloads\my_certificates\Root_CA.cer" -alias IntermediateCA -keystore "C:\Users\alexey.t\Downloads\MyApp\app\src\res\raw\myKeystore.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "C:\Users\alexey.t\Downloads\my_certificates\bcprov-ext-jdk15on-1.46.jar" -storetype BKS -storepass mysecret
  
  Certificate already exists in system-wide CA keystore under alias &lt;thawteprimaryrootca [jdk]&gt;
  
  Do you still want to add it to your own keystore? [no]:  y
  </code></pre>
  
  <p>Here is output I get</p>
  
  <pre><code>Certificate was added to keystore
  
  [Storing C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks]
  
  keytool error: java.io.FileNotFoundException: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks (The system cannot find the path specified)
  java.io.FileNotFoundException: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks (The system cannot find the path specified)
      at java.io.FileOutputStream.open0(Native Method)
      at java.io.FileOutputStream.open(Unknown Source)
      at java.io.FileOutputStream.&lt;init&gt;(Unknown Source)
      at java.io.FileOutputStream.&lt;init&gt;(Unknown Source)
      at sun.security.tools.keytool.Main.doCommands(Unknown Source)
      at sun.security.tools.keytool.Main.run(Unknown Source)
      at sun.security.tools.keytool.Main.main(Unknown Source)
  </code></pre>
  
  <p>Also according to SO answer above I can use next command to check if <code>keystore</code> exist</p>
  
  <pre><code>keytool -list -keystore "C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "C:\Users\alexey.t\Downloads\ElAl_certificates\bcprov-ext-jdk15on-1.46.jar" -storetype BKS -storepass mysecret
  </code></pre>
  
  <p>Here is output</p>
  
  <pre><code>keytool error: java.lang.Exception: Keystore file does not exist: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks
  </code></pre>
  
  <p>So, what am I doing wrong?</p>