Java Runtime Environment (JRE) – As name suggests, JRE contains the class libraries, loader class and JVM to run or execute Java program
Java Development Kit (JDK) – JDK is used to develop and run Java program which includes JRE, compliers, debuggers and other tools needed for Java development. All JDK versions comes bundled with Java Runtime Environment (JRE), no need to download separately.
In short, if you want to run a Java application, only need a JRE which includes a JVM and if you are a developer looking to program in Java, you need a JDK which includes JRE libraries & JVM.
Execute below command to find whether Java is already installed or not.
$ java -version
Installing default JRE/JDK
First update you system with below command:
$ sudo apt update
Execute the following command to install Java Runtime Environment (JRE) and .
Execute the following command to install Java Development Kit (JDK)
$ sudo apt install default-jdk
Verify the installation with the following command:
$ javac -version
How to find if JRE or JDK is installed on system:
Open terminal or command prompt and execute the following command:
$ java -version // this will check JRE version
$ javac -version // this will check java complier version.
Install Specific Version of OpenJDK
If you want to install specific version of OpenJDK, open terminal and execute the following command. Below command to install OpenJDK 8.
$ sudo apt install openjdk-8-jdk
If you have multiple java is installed on single server, you can configure the default version using below command.
$ sudo update-alternatives –config java
Type selection number and press enter key, this will change the default java.
Eclipse IDE installation
Install it via terminal or command prompt, open terminal and type following command.
$ sudo snap install eclipse –classic
Following output should be seen on successful installation of Eclipse IDE.
Starting Eclipse IDE
Eclipse is installed now, go to activity and search eclipse and click on icon as shown below.
We have seen how to install Eclipse IDE and Java on Ubuntu Linux. To know more about and get started with Eclipse visit Eclipse documentation page.