'Change empty alias keytool

Hi i want change alias using keytool but my initial alias is empty. I want set alias "1" from empty.

keytool -changealias -alias "" -destalias "1" -keystore "A:\path\to\key" -storepass Password

but then..

Illegal option: 1



Solution 1:[1]

You appear to be on Windows. If you used the Oracle installer package (not a ZIP or an OpenJDK 'vendor'), check where keytool (and maybe where java also) to see if it's in a version-specific location like \Program Files\Java\jdk-11.0.14\bin or in a 'generic' location like \ProgramData\Oracle\Java\javapath or \Program Files\Common Files\Oracle\Java\javapath. The latter are stubs that forward to the real code in the currently-correct specific location, which may change every time you update, and for java I have encountered cases where forwarding 'lost' an empty argument. I've never encountered this with keytool -- but I don't think I've ever used an empty argument to keytool, so it might have the same problem without my noticing.

If so, try running the 'real' keytool program by explicitly specifying the version-specific location.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dave_thompson_085