Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need to use keytool and I want to use possible newest version. I have on my Ubuntu oracle jdk, and OpenJDK.

~$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

keytool command is located in two places:

~$ type -a keytool
keytool is /usr/bin/keytool
keytool is /usr/local/java/jdk1.7.0_25/bin/keytool
~$ file /usr/bin/keytool
/usr/bin/keytool: symbolic link to /etc/alternatives/keytool
~$ file /etc/alternatives/keytool
/etc/alternatives/keytool: symbolic link to /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/keytool

How do I know if I use /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/keytool or /usr/local/java/jdk1.7.0_25/bin/keytool ?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Use which instead.

$ which keytool
/usr/bin/keytool
share|improve this answer

or you can use whereis, like:

whereis keytool

for extended information including which output at first place.

share|improve this answer

If the command is an managed by alternatives, you may want to use:

update-alternatives --list keytool

That will output all registered alternatives. This is not a simple search of bin directories. See example:

update-alternatives --list vi
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.