The Java keytool is a command line utility provided with each installation of Java, and this article will guide you through the process of a keytool install in both WIndows and Linux. Keytool is used to manage keystore, symmetric asymmetric (public/private) keys, and certificates. Many applications and application servers use keystores in the form of the Java Keystore (jks) or PKCS12 keystore, which can be maintained by the Java keytool.
The following examples will demonstrate how to install keytool on windows and linux. To answer the general of question of how to install keytool, it’s only a matter of installing the version of java, which is shipped with the keytool command line utility.
Install Keytool Windows
This example will demonstrate how to install keytool on Windows, specifically on Windows 10. This example may be used on other versions of WIndows as well.
If your Windows machine already has Java installed, you are good to go. You may type the following keytool help command to learn how to begin using keytool on Windows.
keytool --help
If Java is not already installed, you will need to install the java version of your choice. In this example we will be installing the Amazon Corretto JDK for WIndows 7 or Later. It can be found here: https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html
After downloading the .msi file, click the file to start the installation wizard.
The installation Wizard will look like the following:

Follow the wizard providing the default options to complete the installation of amazon corretto 11 JDK on Windows.
After Java is installed you will need to set the JAVA_HOME environment variable if not set by the installation process.
After verifying the JAVA_HOME environment variable was set, open a command prompt. To verify Java was installed, run the following command to check the version:
java -version
Then type keytool --help
as described above to begin using keytool.
Install Keytool Linux
This example will demonstrate how to install keytool on linux, specifically on Ubuntu 20.04. This example may be used on most if not all versions of Ubuntu or any debian based linux operating system. The general principals also apply across all flavors of linux, with the primary difference being the package manager used for the installation of keytool.
If your linux machine already has Java installed, you are good to go. You may type the following keytool help command to learn how to begin using keytool on Linux.
keytool --help

If Java is not already installed, you will need to install the java version of your choice. In this example we will be installing the Amazon Corretto JDK, specifically java-11-amazon-corretto-jdk. To install amazon corretto 11, run the following command:
sudo apt install java-11-amazon-corretto-jdk
After the command completes running, check that it was successfully installed by running the following command to check the java version:
java --version

After checking the version of java installed, go ahead with typing keytool --help
as described above to verify that keytool is working with your java installation.
Conclusion
The article demonstrated how to install keytool on both the Windows and Linux platforms. If you would like to see more examples of how to install the Java keytool please let us know in the comments. Until then, visit all of our posts on how to use the java keytool for more examples.
Leave a Reply