How to delete already import certificate/alias by keytool command? : <p>I am trying to delete already import certificate by keytool command </p>

<pre><code> keytool -delete -noprompt -alias "initcert" -keystore keycloak.jks
</code></pre>

<p>But getting below exception</p>

<blockquote>
  <p>keytool error: java.lang.Exception: Keystore file does not exist:
  keycloak.jks</p>
</blockquote>

<p>Same issue with </p>

<pre><code>keytool -delete  -alias "initcert" -keystore keycloak.cer
</code></pre>

<p>issue</p>

<blockquote>
  <p>keytool error: java.lang.Exception: Keystore file does not exist:
  keycloak.cer</p>
</blockquote>

<p>Now i am trying to import the certificate with same alias  name</p>

<pre><code> keytool -import -noprompt -trustcacerts -alias "initcert" -file "C:\Code_Base\keycloak_certificates\keycloak_135.250.138.74_server\keycloak.cer" -keystore "C:\Program Files\Java\jdk1.8.0_152\jre\lib\security\cacerts"
</code></pre>

<p>But again end with </p>

<blockquote>
  <p>keytool error: java.lang.Exception: Certificate not imported, alias
   already exists</p>
</blockquote>
