Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 switched to linux (Ubuntu 12.04) this morning and find it great but messed up while installing java. :-(.

I have installed jdk6.0_6 successfully but when I run java command in terminal, I get this

 ravi@ravi-LIFEBOOK-AH531:~$ java
The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.6-jre-headless
 * openjdk-6-jre-headless
 * gcj-4.5-jre-headless
 * openjdk-7-jre-headless
Try: sudo apt-get install <selected package>

Could someone help me with this?

Below are the steps that I followed to install:

  1. copied file named jdk-6u6-linux-x64.bin to my documents
  2. from terminal executed chmod a+x jdk-6u6-linux-x64.bin
  3. and then executed sudo ./jdk-6u6-linux-x64.bin
  4. In terminal I accepted the license agreement and done.
share|improve this question
Please tell us exactly how did you installed java. This can help you: How do I install Oracle JDK 6?. – Eric Carvalho Dec 15 '12 at 15:08 this link worked for me. Thank you – Ravi.Kumar Dec 15 '12 at 16:11
up vote 1 down vote accepted

The location you installed Java to is probably not on your PATH variable. This is the list of directories the OS looks for executables in.

You can see this environment variable with

echo $PATH

You can edit the path your user gets by changing your ~/.profile script, or the PATH the whole system gets by adding a script to /etc/profile.d ; you'll need to add the folder the java executable is in.

An alternative is to make a symlink to the java executable from a folder that is already on your path.

The third alternative is to install one of the available Java packages from the Ubuntu repositories instead of downloading packages from Oracle. For most purposes, OpenJDK works fine, OpenJDK 7 being the official standard JDK for the Java compliance testing now. The Ubuntu packages of Java work correctly without additional setup for most cases.

share|improve this answer

Your Answer


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.