Oracle will ship the stable version of JDK 8 on summer next year. However, some early builds are already available which you may install for testing purposes. To do this in Ubuntu, you will need to add a Personal Package Archive or PPA and download the installer., The installer will fetch the JDK binaries for you.Note: This JDK is for testing purposes only and must not be used in an enterprise environment.
To add the PPA, open terminal and type the following commands. You can also do the same by editing the software sources in Ubuntu Software Center.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Once installed, you can view the JDK version with the command: java -version