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 am using Ubuntu. How to know if Java is installed ?

share|improve this question
add comment

migrated from stackoverflow.com Nov 11 '11 at 22:48

This question came from our site for professional and enthusiast programmers.

4 Answers

up vote 11 down vote accepted

In your terminal type java -version or just javac if it returns something, then you've java installed. Otherwise, there is also the possibility that the path variables do not contain the java path. So use locate jdk or locate java to see if you have the java binary. Don't forget to run updatedb if you are using locate for the first time.

share|improve this answer
    
+1 for updatedb –  Jack Nov 16 '11 at 17:54
add comment

You should be able to run which java or java -version.

share|improve this answer
add comment

The above answers seems pretty OBVIOUS..!! (only if you have to check JAVA)

For checking any package (whether it is installed or not), u can do the following :

sudo aptitude search packageName

It will get you a list of Packages (that you wanted to find out, whether installed or not). In the list, on the left hand side, (the key to the Your question) , there lies a small Alphabet denoting whether the corresponding package is already installed on your system or not.

For example, for java, you will do like :

sudo aptitude search jdk

and you will get something like :

i A default-jdk

i A default-jdk-doc

i A openjdk-6-doc i A

i A openjdk-6-jdk

i A openjdk-6-jre v

p openjdk-6-jre-shark

p openjdk-6-jre-zero

p openjdk-6-source

Now the "i" on the left shows that it is installed.

CHEERS..!!

share|improve this answer
add comment
java -v

should do the job aswell.

share|improve this answer
    
If it's on the $PATH. –  Daniel Beck Nov 12 '11 at 14:27
add comment

Your Answer

 
discard

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