import java.io.FileInputStream; import java.io.FileOutputStream; import java.security.KeyStore; public class MainClass { public static void main(String args[]) throws Exception { char[] oldpass = args[0].toCharArray(); char[] newpass = args[1].toCharArray(); String name = "mykeystore"; FileInputStream in = new FileInputStream(name); KeyStore ks = KeyStore.getInstance("JKS"); ks.load(in, oldpass); in.close(); FileOutputStream output = new FileOutputStream(name); ks.store(output, newpass); output.close(); } }