Software Development

How to Install Java, OpenJDK on Ubuntu

Blog bannerBlog banner

Objective

Java is a versatile, object-oriented programming language developed by Sun Microsystems (acquired by Oracle Corporation). It is designed to be platform-independent, allowing developers to write code that can run on any device or platform with a Java Virtual Machine (JVM). Java is widely used for building a variety of applications, including web, mobile, enterprise, and embedded systems.

Java Development Kit (JDK) and Java Runtime Environment (JRE) are essential components of the Java platform, each serving a specific purpose in the development and execution of Java applications.

Java Development Kit (JDK)

The JDK is a software development kit that provides tools, executables, and binaries required for developing, compiling, and running Java applications. It includes the Java Compiler(javac), Java Virtual Machine (JVM), various development tools, and an extensive set of libraries and APIs.

Components:

Java Compiler (javac) : Translates Java source code into Java bytecode..

Java Virtual Machine (JVM) : Executes Java bytecode on the target hardware.

Development Tools : Includes tools for debugging (jdb), documentation generation (Javadoc), and packaging (jar).

Use Case :

Developers use the JDK during the software development phase to write, compile, and test Java applications. It provides everything needed for the entire development life cycle.

Java Runtime Environment (JRE)

The JRE is a subset of the JDK and provides the runtime environment for Java applications. It includes the JVM, class libraries, and other supporting files needed for the execution of Java applications.

Components:

Java Virtual Machine (JVM): Executes Java bytecode.

Class Libraries: A set of precompiled classes and methods that Java applications can use for common tasks.

Use Case :

End-users who only need to run Java applications use the JRE. Itdoesn't include development tools like the compiler or debugger.

Relationship between JDK and JRE:

 The JDK includes the JRE, meaning that if you install the JDK, you also have everything in the JRE. However, the reverse is not true—the JRE doesn't include development tools.

Developers use the JDK during the development phase to create and test applications. End-users only need the JRE to run applications.

In summary, the JDK is a comprehensive package for Java development, including tools and libraries for both development and execution, while the JRE is a runtime environment for end-users, containing only what is necessary to run Java applications.

Let’s Get Started

This guide is predicated on the assumption that you are using an Ubuntu 22.04 server. But don't worry if your server is running a different operating system, the commands and concepts are still mostly applicable.

Step 1 : let’s Install Java

1.1 update your apt package index:

To start with installation let's first update your apt package index in your Linux:

Our Latest Blogs

Load More

Our Latest Blogs

View All Blogs