问题
I have tried to execute keytool from Java bin directory but I get an error with warning bash: keytool: command not found.
root@xxxxxx]# keytool -genkey -alias mypassword -keyalg RSA
bash: keytools: command not found
回答1:
These are the steps which solved my problem:
search the path where my java was installed
find / -name jre
move to java directory (where jre was installed on my server)
cd /path/to/jre/location
create ssl certificate with keytool command
./keytool -genkey -alias [mypassword] -keyalg [RSA]
回答2:
Use
./keytool -genkey -alias mypassword -keyalg RSA
回答3:
Ensure jre is installed.
cd /path/to/jre/bin/folder
As keytool file is present in the bin folder of jre, give path till bin as in the command above.
Then you can do:
keytool -genkey -alias aliaskeyname -keyalg RSA -keystore C:\mykeystore
The additional option -keystore will help you to specify the path where you want the generated self signed certificate.
回答4:
It seems that calling sudo update-alternatives --config java
effects keytool. Depending on which version of Java is chosen it changes whether or not keytool is on the path. I had to chose the open JDK instead of Oracle's JDK to not get bash: /usr/bin/keytool: No such file or directory
.
回答5:
find your jre location ::sudo find / -name jre
And then :: sudo update-alternatives --install /usr/bin/keytool keytool /opt/jdk/<jdk.verson>/jre/bin/keytool 100
回答6:
You tried:
sudo apt-get install oracle-java6-installer --reinstall
and:
sudo update-alternatives --config keytool
回答7:
If you are looking for keytool
because you are working with Android studio / Google Firebase, there is a keytool bundled with Android Studio. After extracting the zip file, the path to keytool is android-studio/jre/bin
.
回答8:
Keytool comes with your Java library. So you have to execute the Keytool command from your /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/bin directory. Or you can add JAVA_HOME to your environmental variables (Windows) or ~/.bash_profile (Linux)
回答9:
Please follow the steps:
first set the domain using
setDomain.sh
command go todomain/bin
location and execute./setDomain.sh
commandgo to
java/bin
folder and executekeytool
command.
keytool -genkey -keyalg RSA -kaysize 2048 -alias name -kaystore file.jks
来源:https://stackoverflow.com/questions/16333635/keytool-error-bash-keytool-command-not-found