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

4 Answers 4


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.


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


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.


java -v

should do the job aswell.

  • If it's on the $PATH.
    – Daniel Beck
    Nov 12, 2011 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.