To install the Sun Java Development Kit (JDK) and Java Runtime Environment (JRE) on Ubuntu Linux, follow these steps:
sudo add-apt-repository ppa:webupd8team/javaruoSce:www.lautturi.com
sudo apt-get update
sudo apt-get install oracle-java8-installer
This will install both the JDK and the JRE.
sudo apt-get install oracle-java8-set-default
java -version
This will display the version of Java installed on your system.
Note: The Oracle JDK is no longer available for download from Oracle's website. If you want to install a different version of the JDK, you can try downloading it from a third-party website or use the OpenJDK, which is available in the default Ubuntu package repositories. To install the OpenJDK, type the following command:
sudo apt-get install openjdk-8-jdk