Install Oracle Java and OpenJDK for Linux
What is Java?
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.
Some Variations of Java:
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:
- OpenJDK 7
- OpenJDK 8
- Oracle Java 8
Installing OpenJDK 7
The commands below will install OpenJDK 7 JRE & JDK for your distribution of choice.
For OpenJDK 7 JRE
sudo apt-get install openjdk-7-jre
sudo yum install java-1.7.0-openjdk
For OpenJDK 7 JDK
sudo apt-get install openjdk-7-jdk
sudo yum install java-1.7.0-openjdk-devel
Installing OpenJDK 8
The commands below will install OpenJDK 8 JRE & JDK for your distribution of choice.
For OpenJDK 8 JRE
sudo apt-get install openjdk-8-jre
sudo yum install java-1.8.0-openjdk
For OpenJDK 8 JDK
sudo apt-get install openjdk-8-jdk
sudo yum install java-1.8.0-openjdk-devel
Installing Oracle Java 8
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.
Related TutorialsHow to Write Tutorials by Markdown and Earn Money
Setup and Configuration of OpenVPN Server on CentOS 7.2
Installing LAMP (Linux Apache MySQL and PHP) Stack on CentOS 7 64bit
Setup a Master-to-Master Replication Between Two MariaDB Servers
Setup and Configuration of FreeRadius + MySql on Ubuntu 14.04 64bit