How To Install JDK And JRE In Ubuntu?
Java is one of the most popular programming languages used today. One of the biggest reasons why Java is so popular is platform independence. That means a program written in java can run on several different types of machines. But the only thing is JRE(Java Runtime Environment) should be installed on the computer where you want to run the code. There are various packages available such as JRE, OpenJDK, Oracle JDK, etc for the installation of java in Linux. Ahead in this article, we will see the difference between these packages. And how to install it on Debian, Ubuntu or a distribution based on them.
Different packages for Java platform
Java platform consists of various programs and each of them has its own functionality. For example –
Java compiler is provided as part of JDK(Java Development Kit) which compiles java source code to an intermediate code called byte code. JDK is required if you want to develop software using java. There are different versions of it available in Linux –
- OpenJDK – It is an open-source implementation of JDK It works the same as Oracle JDK.
- Oracle JDK – It is the official JDK from Oracle. It has a few additional features. Some applications such as android studio recommend using Oracle JDK to avoid any issue while developing software.
Java Runtime Environment or JRE consists of Just-In-Time compiler which converts intermediate code i.e. byte code to native machine code. Installing JRE is sufficient if you want only run java programs.
Check if Java is installed or not
OpenJDK comes pre-installed in many distributions. To check if it is installed in your system or not, use the following command in your terminal-
This will display the current version of OpenJDK installed in your system.
How to Install OpenJDK (Java 11) in Ubuntu?
As discussed above OpenJDK is an opensource implementation of the java development kit. It comes preinstalled in Ubuntu, Linux Mint and many other distributions. Still, If it is not in your system and you want to install it then use the following command in your terminal-
sudo apt-get install default-jdk
This will include JRE in it. If you want to install only JRE then use the following command –
sudo apt-get install default-jre
If you want to uninstall it for any reason then use the following command –
sudo apt-get purge openjdk*
How to Install Oracle Java 13 (JDK 13) in Ubuntu?
Oracle JDK is officially distributed by Oracle. To install it in Debian/Ubuntu-based distribution follow the given steps –
1. Add the Linuxuprising PPA in your system with the following command-
sudo add-apt-repository ppa:linuxuprising/java
and then update the OS repository with
sudo apt-get update
2. Now use the following command to install the java 13 in your system –
sudo apt install oracle-java13-installer
This will prompt you for Oracle network license agreement, read it by scrolling down and then press the Tab button to select Ok. The screen will look something like this –
Once you press ok it will again ask you to accept the license, select yes and then press enter.
How to Make Oracle Java 13 as default?
If oracle java 13 doesn’t become default automatically in your system then make it default with the following command –
sudo apt install oracle-java13-set-default
and if you don’t want it to be default anymore, then use the following command –
sudo apt remove oracle-java13-set-default
You might also like
Sed stands for stream editor It was based on the scripting feature of ed(a line based interactive text editor in Unix). It is used to perform basic text transformation on
This post was last updated on September 24th, 2019 at 07:31 pmCommand-line interface(CLI) is a way that allows users to interact with computer programs through commands. A user issues commands
FTP or File Transfer Protocol is a standard networking protocol used to transfer files between client and server. An FTP user may authenticate themselves by using username and a password.