Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Ubuntu. How to know if Java is installed ?

share|improve this question

migrated from Nov 11 '11 at 22:48

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

up vote 15 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

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

share|improve this answer

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.


share|improve this answer
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

You must log in to answer this question.