tutorials questions & answers
by Daniel

Install Oracle Java and OpenJDK for Linux

TAGS:

Install Oracle Java and OpenJDK for Linux

Introduction

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.


Prerequisites

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

Ubuntu/Debian:

sudo apt-get install openjdk-7-jre 

CentOS/Fedora:

sudo yum install java-1.7.0-openjdk

For OpenJDK 7 JDK

Ubuntu/Debian:

sudo apt-get install openjdk-7-jdk 

CentOS/Fedora:

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

Ubuntu/Debian:

sudo apt-get install openjdk-8-jre 

CentOS/Fedora:

sudo yum install java-1.8.0-openjdk

For OpenJDK 8 JDK

Ubuntu/Debian:

sudo apt-get install openjdk-8-jdk 

CentOS/Fedora:

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.

Ubuntu/Debian:

sudo apt-get install oracle-java8-installer

CentOS/Fedora:

wget http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.rpm
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.

comments (0)

    Start now for as low as $3,99 a month!

     
    Open livechat