How to Find and Run the Keytool

How can I find and run the keytool

I found a solution by myself as below quote. It works fine.

"C:\Program Files\Java\jdk1.6.0_26\bin\keytool.exe" -exportcert -alias
> sociallisting -keystore "D:\keystore\SocialListing" |
> "C:\cygwin\bin\openssl.exe" sha1 -binary | "C:\cygwin\bin\openssl.exe"
> base64

Keytool is not recognized as an internal or external command

You are getting that error because the keytool executable is under the bin directory, not the lib directory in your example. And you will need to add the location of your keystore as well in the command line. There is a pretty good reference to all of this here - Jrun Help / Import certificates | Certificate stores | ColdFusion

The default truststore is the JRE's cacerts file. This file is typically located in the following places:

  • Server Configuration:

    cf_root/runtime/jre/lib/security/cacerts

  • Multiserver/J2EE on JRun 4 Configuration:

    jrun_root/jre/lib/security/cacerts

  • Sun JDK installation:

    jdk_root/jre/lib/security/cacerts

  • Consult documentation for other J2EE application servers and JVMs


The keytool is part of the Java SDK and can be found in the following places:

  • Server Configuration:

    cf_root/runtime/bin/keytool

  • Multiserver/J2EE on JRun 4 Configuration:

    jrun_root/jre/bin/keytool

  • Sun JDK installation:

    jdk_root/bin/keytool

  • Consult documentation for other J2EE application servers and JVMs

So if you navigate to the directory where the keytool executable is located your command line would look something like this:

keytool -list -v -keystore JAVA_HOME\jre\lib\security\cacert -storepass changeit

You will need to supply pathing information depending on where you run the keytool command from and where your certificate file resides.

Also, be sure you are updating the correct cacerts file that ColdFusion is using. In case you have more than one JRE installed on that server. You can verify the JRE ColdFusion is using from the administrator under the 'System Information'. Look for the Java Home line.

I can’t find the Android keytool

keytool comes with the Java SDK. You should find it in the directory that contains javac, etc.

running keytool command programmatically


 String command = "keytool -v \
-genkeypair \
-dname "$SERVER_DN" \
-keystore "$SERVER_DIR"/keystore.jks \
-storepass "$SERVER_PW" \
-keypass "$SERVER_PW" \
-keyalg "EC" \
-alias server \
-validity 1825 \
-deststoretype pkcs12 \
-ext KU=digitalSignature,dataEncipherment,keyEncipherment,keyAgreement \
-ext EKU=serverAuth \
-ext SAN="$SERVER_SAN""

ProcessBuilder pb = new ProcessBuilder("cmd.exe");
Process process = pb.start();
PrintWriter commandWriter = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(process.getOutputStream())));
commandWriter.println(command);
commandWriter.flush();

Also you can read errorStream or inputStream from process.getErrorStream() and process.getInputStream.

keytool' is not recognized as an internal or external command

That happens because you haven't added the bin directory of your JAVA_HOME environment variable in your %PATH%.

  1. Add the environment variable JAVA_HOME with path C:\Program Files\Java\jdk1.8.0_131 without the bin directory.
  2. Add the %JAVA_HOME%\bin directory at the end of your %PATH%.

keytool command not running on command prompt. (SHA-1 Key Flutter)

try this command from cmd or flutter terminal . go to C:/your profile/ project name/android and then type gradlew signingReport . it will give all SHA-1 and all other certificates.

In my case it look like this -

C:\ronan\facebook\android>gradlew signingReport

Where is the Keytool application?

keytool is part of the standard java distribution.

In a windows 64-bit machine, you would normally find the jdk at

C:\Program Files\Java\jdk1.8.0_121\bin

It is used for managing keys and certificates you can sign things with, in your case, probably a jar file.

If you provide more details of what you need to do, we could probably give you a more specific answer.

How do I specific a file path to an existing SSL certificate using Java Keytool via Windows Command Prompt?

First make sure you’re in your jdk bin dir.

Then try again, but with the path in quotes:

keytool -importcert -trustcacerts -keystore keystore.p12 -storetype pkcs12 -alias myAlias -file “C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\SSL\my_ssl_certificate.cer”

ERROR:'keytool' is not recognized as an internal or external command, operable program or batch file

Check that the directory the keytool executable is in is on your %PATH% environment variable.

For example, on my Windows 7 machine, it is in
C:\Program Files (x86)\Java\jre6\bin, and my %PATH% variable looks like C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Java\jre6\bin;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ (and many other entries)



Related Topics



Leave a reply



Submit