How to install JDK(Java Development Kit) on Ubuntu OS

Ubuntu supports for a default JDK which is OpenJDK(not OracleJDK ).

what are the differences between OpenJDK and OracleJDK?.
  • OpenJDK is a free and open-source implementation of Java SE Platform Edition with contribution from Oracle and open Java community.
  • OracleJDK is developed and maintained by the Oracle itself whereas OpenJDK can be developed by Java Community.
  • Oracle will deliver releases every three years, while OpenJDK will be released every six months.
  • All the changes that are made by an OpenJDK version will be only valid until the next version released (6months).
  • Oracle has versions that support for a long term( version 8,11) whereas other versions are only available for a short term(version 6).

Note: on Ubuntu, by default OpenJDK supports for Ubuntu repositories

To install OpenJDK on your Ubuntu machine just type the following commands on your terminal.

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install default-jdk

To install OracleJDK on your Ubuntu machine just type the following commands on your terminal.

sudo apt-get update
sudo apt-get upgrade

Note: We know that, by default Ubuntu repositories are not supported for OracleJDK, so we need to install a 3rd party repository (PPA). We’ll use the one from Linux Uprising, but you can use any other repository:

sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update

sudo apt-get install oracle-java11-installer

Good, you done. To see whether the installation is done or not, just type java -versionon your terminal then the version of your installed JDK will be shown up.

click here:- How to download and set the PATH for OracleJDK on Windows OS

4 thoughts on “How to install JDK(Java Development Kit) on Ubuntu OS

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.