Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have installed java but I could not get any java command to work! Below shows what I get when I try to run java commands:

sultan@ubuntu:~$ 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>

sultan@ubuntu:~$ sudo apt-get install openjdk-7-jre
[sudo] password for sultan:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openjdk-7-jre is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
share|improve this question
My java executable (from openjdk) is in /usr/bin. Is the executable there on your system? Is /usr/bin not on your path for some reason (do echo $PATH to see). –  Ash Mar 29 '13 at 1:38
What's the output of update-java-alternatives -l? –  Eric Carvalho Mar 29 '13 at 2:16
I installed sun jdk.. it seems to have been successfully installed. THANKS GUYS –  Sultan Abraham Mar 29 '13 at 4:10
If you have solved your problem, please consider closing your question or, better yet, answer it yourself. Thanks :) –  Mochan Apr 2 '13 at 8:05

Your Answer


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

Browse other questions tagged or ask your own question.