Java Keytool 未被识别为内部或外部命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19431788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Keytool is not recognized as an internal or external command
提问by Hyman
I am trying to discover the list of trusted authorities in my Java Runtime using the instructions in this article. When I typed the command below:
我正在尝试使用本文中的说明在我的 Java 运行时中发现受信任的权限列表。当我输入以下命令时:
C:\ColdFusion8\runtime\jre\lib>keytool -list -storepass changeit -noprompt -keystore
I got the following error:
我收到以下错误:
'keytool' is not recognized as an internal or external command, operable program or batch file.
'keytool' 不是内部或外部命令,也不是可运行的程序或批处理文件。
I checked that the directory containing my keytool executable is in the path.
(On my Windows 7 machine, it's in C:\Program Files (x86)\Java\jre6\bin
)
Despite this, the command line will not recognise the keytool
command.
我检查了包含我的 keytool 可执行文件的目录是否在路径中。(在我的 Windows 7 机器上,它位于C:\Program Files (x86)\Java\jre6\bin
)尽管如此,命令行将无法识别该keytool
命令。
I'm assuming that there are two separated commands mentioned in the doc:
我假设文档中提到了两个单独的命令:
C:\CFusionMX\runtime\jre\lib>keytool -list -storepass changeit -noprompt -keystore
C:\CFusionMX\runtime\jre\lib\security\cacerts
C:\CFusionMX\runtime\jre\lib>keytool -list -storepass changeit -noprompt -keystore
C:\CFusionMX\runtime\jre\lib\security\cacerts
EDIT:
编辑:
By the way can I use the following process instead of complex steps mentioned in the answer?
顺便说一句,我可以使用以下过程而不是答案中提到的复杂步骤吗?
- When I opened the WSDL into my browser, I saw the Lock icon, when I clicked on it a "Certificate" window opened
Then I clicked on "Install Certificate" option
A Certificate Import Wizard window opened, I clicked on Next I saw two options
- a) Automatically select the certificate store based on the type of certificate (this option was selected automatically)
- b) Place all certificates in the following store
- 当我在浏览器中打开 WSDL 时,我看到了锁定图标,当我点击它时会打开一个“证书”窗口
然后我点击“安装证书”选项
证书导入向导窗口打开,我点击下一步我看到两个选项
- a) 根据证书类型自动选择证书存储(此选项是自动选择的)
- b) 将所有证书放在以下存储中
I decided to select option (b)
, but I'm confused which certificate store I should select here.
我决定选择 option (b)
,但我很困惑我应该在这里选择哪个证书存储。
采纳答案by Miguel-F
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
您收到该错误是因为keytool
可执行文件位于bin
目录下,而不是lib
示例中的目录下。您还需要keystore
在命令行中添加您的位置。这里有一个很好的参考 - Jrun 帮助/导入证书 | 证书商店| 冷聚变
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
默认信任库是 JRE 的 cacerts 文件。此文件通常位于以下位置:
服务器配置:
cf_root/runtime/jre/lib/security/cacerts
JRun 4 配置上的多服务器/J2EE:
jrun_root/jre/lib/security/cacerts
Sun JDK安装:
jdk_root/jre/lib/security/cacerts
查阅其他 J2EE 应用程序服务器和 JVM 的文档
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
keytool 是 Java SDK 的一部分,可以在以下位置找到:
服务器配置:
cf_root/运行时/bin/keytool
JRun 4 配置上的多服务器/J2EE:
jrun_root/jre/bin/keytool
Sun JDK安装:
jdk_root/bin/keytool
查阅其他 J2EE 应用程序服务器和 JVM 的文档
So if you navigate to the directory where the keytool
executable is located your command line would look something like this:
因此,如果您导航到keytool
可执行文件所在的目录,您的命令行将如下所示:
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.
您需要根据运行 keytool 命令的位置和证书文件所在的位置提供路径信息。
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.
此外,请确保您正在更新 ColdFusion 正在使用的正确 cacerts 文件。如果您在该服务器上安装了多个 JRE。您可以在“系统信息”下从管理员那里验证 JRE ColdFusion 正在使用。查找 Java Home 行。
回答by Saurabh Chaturvedi
Run the cmd as run as administratorthis worked for me
以管理员身份运行cmd这对我有用
回答by Mitz K
Execute following command:
执行以下命令:
set PATH="C:\Program Files (x86)\Java\jre7"
set PATH="C:\Program Files (x86)\Java\jre7"
(whichever JRE
exists in case of 64bit).
(以JRE
64 位情况为准)。
Because your Java Path is not set so you can just do this at command line and then execute the keytool
import command.
因为您的 Java 路径未设置,所以您可以在命令行执行此操作,然后执行keytool
导入命令。
回答by martoncsukas
Add your JDK's /binfolder to the
PATH
environmental variable. You can do this under System settings > Environmental variables, or via CLI:set PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_80\bin
Close and reopen your CLI window
将 JDK 的/bin文件夹添加到
PATH
环境变量中。您可以在系统设置 > 环境变量下或通过 CLI 执行此操作:set PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_80\bin
关闭并重新打开 CLI 窗口
回答by Jude
I finally solved the problem!!! You should first set the jrepath to system variables by navigating to::
我终于解决了问题!!!您应该首先通过导航到以下位置来设置系统变量的jre路径:
control panel > System and Security > System > Advanced system settings
Under System variablesclick on new
在系统变量下单击新建
Variable name: KEY_PATH
Variable value: C:\Program Files (x86)\Java\jre1.8.0_171\bin
Where Variable value should be the path to your JDK's bin folder.
其中变量值应该是 JDK 的 bin 文件夹的路径。
Then open command prompt and Change directory to the same JDK's bin folder like this
然后打开命令提示符并将目录更改为相同的 JDK 的 bin 文件夹,如下所示
C:\Program Files (x86)\Java\jre1.8.0_171\bin
then paste,
然后粘贴,
keytool -list -v -keystore "C:\Users\user\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
NOTE: People are confusing jre and jdk. All I did applied strictly to jre
注意:人们混淆了 jre 和 jdk。我所做的一切都严格适用于jre
回答by Majali
Make sure JAVA_HOME is set and the path in environment variables. The PATH should be able to find the keytools.exe
确保设置了 JAVA_HOME 并且环境变量中的路径。PATH 应该能够找到 keytools.exe
Open “Windows search” and search for "Environment Variables"
打开“Windows搜索”并搜索“环境变量”
Under “System variables” click the “New…” button and enter JAVA_HOME as “Variable name” and the path to your Java JDK directory under “Variable value” it should be similar to this C:\Program Files\Java\jre1.8.0_231
在“系统变量”下单击“新建...”按钮并输入 JAVA_HOME 作为“变量名”,在“变量值”下输入 Java JDK 目录的路径,它应该类似于 C:\Program Files\Java\jre1.8.0 _231
回答by Sourabh Biswas
A simple solution of error is that you first need to change the folder directory in command prompt. By default in command prompt or in terminal(Inside Android studio in the bottom)tab the path is set to C:\Users#Name of your PC that you selected\AndroidStudioProjects#app name\flutter_app> Change accordingly:-C:\Users#Name of your PC that you selected\AndroidStudioProjects#app name\flutter_app>cd\
一个简单的错误解决方案是您首先需要在命令提示符下更改文件夹目录。默认情况下,在命令提示符或终端(底部的 Android Studio 内部)选项卡中,路径设置为 C:\Users#您选择的 PC 的名称\AndroidStudioProjects#app name\flutter_app> 相应地 更改:-C:\Users #您选择的 PC 名称\AndroidStudioProjects#app name\flutter_app>cd\