Keytool Command Not Found on Windows? Fix It Fast
In this article
The "keytool command not found" error on Windows means the Java Development Kit (JDK) is either not installed or its bin folder is not on your PATH. The fastest fix is to install a JDK (if you have not) and then add its bin directory to the Windows PATH environment variable, or call keytool using its full path. You do not need a separate keytool download; keytool ships with every standard JDK.
What You'll Need
- Windows 10 or Windows 11 (the steps are nearly identical; labels can differ slightly by version and region).
- A JDK installed, such as Oracle JDK, Eclipse Temurin, Microsoft Build of OpenJDK, or Amazon Corretto. A JRE alone is not enough because keytool is a development tool.
- Administrator rights if you want to change the system PATH for all users. Changing only your user PATH does not require admin rights.
- About five minutes and a Command Prompt or PowerShell window.
Step-by-Step
- Check whether a JDK is already installed. Open Command Prompt (press Windows key, type
cmd, press Enter) and runjava -version. If it prints a version, Java is present, but it may be only a JRE. Then runwhere javato see the folder. If the path ends in\jre\binor a folder without abin\keytool.exe, you likely need a full JDK. - Install a JDK if needed. Download an installer only from the vendor's official site (for example Eclipse Adoptium, Microsoft, Oracle, or Amazon Corretto). Run the installer and accept the defaults. Note the installation folder, which is commonly something like
C:\Program Files\Java\jdk-21orC:\Program Files\Eclipse Adoptium\jdk-21.0.x-hotspot. The exact folder name varies by version and vendor. - Confirm keytool exists. Open File Explorer, go to that JDK folder, open
bin, and look forkeytool.exe. If it is there, the problem is only PATH configuration. If it is missing, you installed a JRE or a partial package; reinstall a full JDK. - Find the exact bin path. Click the address bar in File Explorer while inside the
binfolder and copy the full path. It should look likeC:\Program Files\Java\jdk-21\bin. - Open the Environment Variables dialog. Press the Windows key, type
environment variables, and choose "Edit the system environment variables" (or "Edit environment variables for your account"). In the System Properties window, click Environment Variables. Labels can differ slightly between Windows versions. - Edit the PATH variable. In the top section (User variables) or bottom section (System variables), select
Pathand click Edit. Click New and paste the fullbinpath you copied. Click OK on every open dialog to save. - Open a new Command Prompt. Environment variable changes do not apply to windows that were already open. Close all Command Prompt and PowerShell windows, then open a fresh one.
- Test the command. Run
keytool -help. You should see the keytool usage text listing commands such as-genkeypair,-list, and-exportcert. If you see that output, the fix is complete. - Alternative: use the full path without changing PATH. If you cannot or do not want to edit environment variables, run keytool by its full path, for example
"C:\Program Files\Java\jdk-21\bin\keytool.exe" -list -keystore "%USERPROFILE%\.android\debug.keystore". Quotes are needed because the path contains spaces.
Common Mistakes
- Pointing PATH at the JDK root instead of
bin. The entry must end in\bin, not the JDK folder itself. - Installing only a JRE. A Java Runtime Environment can run Java programs but does not include keytool. Install a JDK.
- Testing in an old terminal window. A Command Prompt opened before the PATH change will still report "not found." Always open a new window.
- Using the wrong slash or missing quotes. Windows paths use backslashes, and any path with spaces must be wrapped in double quotes when typed on the command line.
- Editing the wrong Path entry. There may be both a User Path and a System Path. Adding the JDK bin folder to either works for your account; the System one affects all users.
- Assuming Android Studio or another IDE bundles keytool in a place you can call directly. IDEs often use an embedded JDK, but its location is internal and not on PATH; use a standalone JDK for command-line work.
Tips
- Run
where keytoolafter the fix to confirm which executable Windows will use. If multiple JDKs are installed, the first matching entry on PATH wins. - Keep only one JDK bin folder on PATH unless you have a specific reason to switch versions; multiple entries can cause confusing version mismatches.
- If you use PowerShell, the same PATH rules apply. Restart the PowerShell window after editing variables.
- For Android development, the debug keystore is usually at
%USERPROFILE%\.android\debug.keystore. You can list it withkeytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore"once keytool is on PATH. - When generating a keystore, keep the file and passwords somewhere safe. Losing them can prevent you from updating an app signed with that key.
Troubleshooting
If keytool -help still says the command is not found, work through these checks in order.
- Reopen the terminal. Close every Command Prompt, PowerShell, and terminal tab, then open a new one. This resolves most cases.
- Verify the PATH entry. Reopen Environment Variables, select Path, click Edit, and confirm the JDK
binfolder is listed exactly, with no trailing semicolon and no typo. - Check the file exists. Navigate to the folder in File Explorer and confirm
keytool.exeis present. If not, the JDK install is incomplete or you pointed at the wrong folder. - Run it by full path. If the full-path command works but the short command does not, the problem is definitely PATH, not the JDK.
- Check for conflicting Java installs. Run
where javaandwhere keytool. If they point to different JDK versions, reorder or clean up the Path entries so the intended JDK comes first. - Reinstall the JDK. If keytool.exe is missing from a supposedly full JDK, uninstall it and reinstall from the vendor's official download page. This does not affect your keystore files, but back them up first if they are stored inside the JDK folder (they usually are not).
Frequently Asked Questions
Do I need to install keytool separately?
No. keytool is included with the JDK. Installing a full JDK and adding its bin folder to PATH is all that is required.
Why does keytool work in one terminal but not another?
Environment variables are read when a terminal starts. A window opened before the PATH change keeps the old value. Open a new window.
Can I run keytool without changing PATH?
Yes. Call it by its full path, for example "C:\Program Files\Java\jdk-21\bin\keytool.exe" -help. Quotes are required because of the spaces.
Does a JRE include keytool?
No. A Java Runtime Environment runs Java applications but does not include development tools such as keytool. Use a JDK.
Where is the Android debug keystore on Windows?
It is typically at %USERPROFILE%\.android\debug.keystore. You can inspect it with keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore".
Will changing PATH break other Java programs?
It can change which Java version is used by default. If you rely on a specific version, keep a single JDK bin entry on PATH and confirm with java -version and where java.