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

Possible Duplicate:
How to install the Sun Java JDK?

Hi all,recently i installed ubuntu in virual box inside the a windows os,but i'm unable to install the jdk in that ubuntu,can any one help me out?

share|improve this question

migrated from stackoverflow.com Feb 22 '11 at 15:41

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

marked as duplicate by Jorge Castro, Marco Ceppi Feb 22 '11 at 15:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

here:help.ubuntu.com/community/JavaInstallation and mkyong.com/java/how-to-install-java-jdk-on-ubuntu-linux and ubuntugeek.com/… and jdk-distros.java.net/ubuntu.html net is full of such web page search on it. –  Harry Joy Feb 22 '11 at 10:04
have you tried askubuntu.com? The stack exchange site for questions like this? –  KitsuneYMG Feb 22 '11 at 10:09

3 Answers 3

sudo apt-get install openjdk-6-jdk
share|improve this answer
although this will install the open-jdk version which might not be what you want. –  Joel Feb 22 '11 at 10:02

type java and follow the instructions

share|improve this answer
actually, I would type (ie, I typed) javac to make sure I got the JDK, not the JRE –  Rolf Rander Feb 22 '11 at 10:08
indeed, but I'm hoping this is a skill that would teach more and be useful in future. –  David O'Meara Feb 22 '11 at 11:31

Run sudo synaptic, search for sun java, mark it for installation, and click Apply.

share|improve this answer
thanks, but how to add envoronment variable to path –  jnivasreddy Feb 22 '11 at 10:37
Just link /usr/bin/java to the installed java binary. –  Subhash Feb 22 '11 at 10:39
PATH=$PATH:/home/user/path/to/executable here path to jdk/bin –  Jigar Joshi - org.life.java Feb 22 '11 at 10:43
To add JAVA_HOME and JDK_HOME to your environment variables, one usual way is to add their definition to /etc/environment –  Delete Feb 22 '11 at 11:17