I\'ve been trying to install the jdk on my ubuntu after downloading it.
first I\'ve used: sudo apt-get update
then: sudo apt-get install jdk*
Command Line option - Ubuntu
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
Then in terminal
sudo apt-get install oracle-java8-installer
When there are multiple Java installations on your System, the Java version to use as default can be chosen. To do this, execute the following command.
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
Edit - Manual Java Installation
Download oracle jdk
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Extract zip into desired folder
e.g /usr/local/ after extract /usr/local/jdk1.8.0_65
Setup
sudo update-alternatives --install /usr/bin/java java /usr/local/jdk1.8.0_65/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/local/jdk1.8.0_65/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/local/jdk1.8.0_65/bin/javaws 1
sudo update-alternatives --set java /usr/local/jdk1.8.0_65/bin/java
sudo update-alternatives --set javac /usr/local/jdk1.8.0_65/bin/javac
sudo update-alternatives --set javaws /usr/local/jdk1.8.0_65/bin/javaws
Edit /etc/environment set JAVA_HOME path for external applications like Eclipse and Idea