Note: This is an old question and the answers reflect the world as it was then. Modern Ubuntu distributions have OpenJDK available which can be installed with
sudo apt install default-jdk
I am trying to install the Java Development Kit (JDK) on Ubuntu Linux distribution, but I am unable to install it.
What are the steps to install it on Ubuntu?
Best Solution
Referring to Ask Ubuntu question How to set JAVA_HOME for OpenJDK?,
How to install
Open JDK(Java developement kit) in Ubuntu (Linux)?Open Terminal from Application Dash or press Ctrl+Alt+T
Update repository:
Optional: To search available distributions of
openjdk, use the following command:Install the appropriate version with the following command:
For
JAVA_HOME(Environment Variable) type command as shown below, in "Terminal" using your installation path...(Note:
/usr/lib/jvm/java-8-openjdkis symbolically used here just for demostration. You should use your path as per your installation.)For
PATH(Environment Variable) type command as shown below, inTerminal:export PATH=$PATH:$JAVA_HOME/binTo check your installation:
java -version