Installing the OpenJDK Java environment on Ubuntu

To install the OpenJDK Java environment for Ubuntu by using the apt-get install command, perform the following steps.

To make openjdk-8 available to the APT environment, perform the following steps:

Enter the following command to add the Personal Package Archive (PPA) for Java SE Development Kit 8:

sudo add-apt-repository ppa:openjdk-r/ppa

Enter the following command to download the package lists from the repositories and update them to get information on the newest versions of packages and their dependencies:

sudo apt-get update

Enter the following command to confirm that JDK 8 is present:

apt-cache search openjdk-8-jdk
Sample Output:
openjdk-8-jdk - OpenJDK Development Kit (JDK)
openjdk-8-jdk-headless - OpenJDK Development Kit (JDK) (headless)

Now, Enter the following command to install OpenJDK Java:

sudo apt-get install openjdk-8-jdk

To check whether the installation was successful, enter the following command:

java -version
Sample Output:
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~14.04-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode) 

Leave a comment

Your email address will not be published. Required fields are marked *