Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!
Java is free to download and install.
Before installing Java you should have a root or a non-root account with sudo enabled on your distribution. This non-root account should be created from a root user account.
There are threee variation of Java, the Standard Edition (SE), the Enterprise Edition (EE) and the Micro Edition (ME) while there are two more versions of SE that we can install, those are the Java Runtime Environment (JRE) and the Java Development Kit (JDK).
JRE is an implementation of the Java Virtual Machine (JVM), which allows you to run compiled Java applications and applets. JDK includes JRE and other software that is required for writing, developing, and compiling Java applications and applets.
Also, there are two implementations of Java in the market, the OpenJDK and Oracle java. Both are the same with the difference that OpenJDK is full open-source and the Oracle java has some proprietary code in it.
We will focus our installation on Java Standard Edition. The installation shall be as follows:
The commands below will install OpenJDK 7 JRE & JDK for your distribution of choice.
sudo apt-get install openjdk-7-jre
sudo yum install java-1.7.0-openjdk
sudo apt-get install openjdk-7-jdk
sudo yum install java-1.7.0-openjdk-devel
The commands below will install OpenJDK 8 JRE & JDK for your distribution of choice.
sudo apt-get install openjdk-8-jre
sudo yum install java-1.8.0-openjdk
sudo apt-get install openjdk-8-jdk
sudo yum install java-1.8.0-openjdk-devel
This section will show you how to install Oracle Java 8. The current version as of writing this tutorial is version 8u102.
Note: You must accept the Oracle Binary Code License Agreement for Java SE, which is one of the included steps, before installing Oracle Java.
sudo apt-get install oracle-java8-installer
sudo yum localinstall jdk-8u102-linux-x64.rpm
Now that java is installed on your system you can now use it to develop and run java based applications.