如何修复 keytool 命令错误 (Linux)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17187221/
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
How to fix keytool command error (Linux)?
提问by mkazma
Am trying to import a certificate to Linux Centos server but it seems that the keytool
command isn't working properly, am having the following error:
我正在尝试将证书导入 Linux Centos 服务器,但该keytool
命令似乎无法正常工作,出现以下错误:
-bash: ./keytool: No such file or directory
-bash: ./keytool: No such file or directory
Any idea how to enable the keytool
command on linux ?
知道如何keytool
在 linux 上启用命令吗?
采纳答案by Kevin Bowersox
You need to run the command from within the directory the key tool resides. The key tool is located within the bin directory of the jdk install.
您需要从关键工具所在的目录中运行该命令。关键工具位于 jdk 安装的 bin 目录中。
cd ~path_to_jdk/bin
keytool
Note that you will need to specify a number of properties to have the key tool perform the operation you would like.
请注意,您需要指定许多属性才能让关键工具执行您想要的操作。
回答by Chandan Nayak
Was facing the same issue, keytool
command was throwing "keytool: command not found" error, this worked
面临同样的问题,keytool
命令抛出“keytool:command not found”错误,这有效
cd /javalocaltion/bin
./keytool command
回答by Cristiano Mendon?a
As said in other answers, it's necessary you to run the command from the folder where keytool's bin is installed.
正如其他答案中所说,您有必要从安装 keytool 的 bin 的文件夹中运行命令。
To know where it's installed run:
要知道它的安装位置,请运行:
whereis keytool
Change your location according to the previous command output and execute keytool command.
根据前面的命令输出更改您的位置并执行 keytool 命令。
回答by shyam k
First you need to set the domain Environment, to do this go to the domain/bin location and execute:
首先,您需要设置域环境,为此转到域/bin 位置并执行:
. ./setDomain.sh
Next, go to the java/bin folder and execute the keytool command.
接下来,转到 java/bin 文件夹并执行 keytool 命令。
keytool -genkey -keyalg RSA -kaysize 2048 -alias name -kaystore file.jks
回答by Tony Power
In case you have no idea where your JDK is installed, just do:
如果您不知道 JDK 的安装位置,请执行以下操作:
sudo find / -iname keytool
sudo find / -iname keytool
and you'll get the path to it.
你会得到它的路径。
Cheers
干杯