How to Install Java JRE on Linux Ubuntu
This is about how to install the latest version of Java JRE on Linux Ubuntu.
First, go to the following link:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
accept the license agreement terms and download the Java JRE archive:

Let’s create a folder for Java and unpack the archive contents into it:
sudo mkdir -p /usr/local/java
For me the archive was saved to the Downloads folder. Wherever it got saved for you - move it to the /usr/local/java folder:
sudo mv ~/Downloads/jre-8u25-linux-x64.tar.gz /usr/local/java
sudo cd /usr/local/java
sudo tar xf jre-8u25-linux-x64.tar.gz
Edit the /etc/profile file with these lines:
JAVA_HOME=/usr/local/java/jre1.8.0_25
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
Next run the following sequence of commands in the console. Pay attention to the folder name jre1.8.0_25, highlighted in bold. In your case it may be different, and the more time has passed since publication, the more the Java version and folder name will differ, accordingly:
sudo update-alternatives -install `/usr/bin/java` `java` `/usr/local/java/**jre1.8.0_25**/bin/java` 1
sudo update-alternatives -install `/usr/bin/javaws` `javaws` `/usr/local/java/**jre1.8.0_25**/bin/javaws` 1
sudo update-alternatives -set java /usr/local/java/**jre1.8.0_25**/bin/java
sudo update-alternatives -set java /usr/local/java/**jre1.8.0_25**/bin/javaws
sudo update-alternatives -set javaws /usr/local/java/**jre1.8.0_25**/bin/javaws
Now let’s apply the contents of the profile file within the active session (after a reboot they take effect automatically):
source /etc/profile
Now, as a result of running the following command:
java -version
