Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know about java -version. I don't care what version I'm currently running. I care what other versions are installed on my linux box. If it's another java -* command I didn't see it in the java -help.

I've tried googling it but the answers are either for Windows or they say "use java -version." I know I've done this before.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

On most Linux distributions you can use update-alternatives like this:

sudo update-alternatives --config java

It will list all packages that provide java command and will let you change it. If you don't want to change it, simply Ctrl-C from it.

There is only one catch - if you installed some java not using official package manager (dpkg/apt-get, rpm/yum), but simply extracted it, update-alternatives will not show it.

share|improve this answer

You could do:

find / -name java 

To find all files. The package manager with your version of Linux should also be able to list them.

share|improve this answer
1  
"package manager" ... Unless someone installed a java version manually. Find is a valid approach, though :) find / -type f -name java -print 2>/dev/null | xargs -i echo {} -version | bash –  tink Mar 21 '13 at 22:22

You leave a lot to be desired as far as details about your setup goes. Java can be installed in different ways in linux. You can install via your distributions package maanger, like apt, yum, yast, or you could install it manually.

How ever you installed it a Java installation needs the java executable to do any good in most cases, so you could use the locate or find commands to find the different ones.

Example which will most likely find links and duplicates, but the directory names should help you pinpoint it:

for f in $(locate -ber '^java$'); do test -x && echo "$f"; done
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.