Java From Beginner To Advanced

0% completed

Previous
Next
JVM, JDK, and JRE (basic overview)

In this lesson, we will learn about three core components that are essential for working with Java:

  • Java Virtual Machine (JVM)
  • Java Runtime Environment (JRE)
  • Java Development Kit (JDK).
Image

These components each play a unique role in creating and running Java applications.

Java Virtual Machine (JVM)

The JVM is the part of Java that runs your compiled code. It reads the bytecode (the code Java compiles into) and translates it into instructions that your computer can understand. Here are the main points about the JVM:

  • Execution Engine: The JVM takes the bytecode and executes it on your computer, making Java programs run on various operating systems.
  • Memory Management: It manages memory by allocating space for objects and handling the recycling of unused data.
  • Platform Independence: Because the JVM works on many systems, Java programs can run on any device that has an appropriate JVM.

Java Runtime Environment (JRE)

The JRE is a package that provides the necessary tools to run Java applications. It includes the JVM along with a set of libraries and other components:

  • Includes the JVM: The JRE contains the JVM, which runs the bytecode.
  • Built-in Libraries: It also has a collection of libraries that Java programs need to run properly. These include standard utilities and APIs.
  • No Development Tools: The JRE is meant for running Java applications, not for developing them. If you only want to run programs, the JRE is sufficient.

Java Development Kit (JDK)

The JDK is intended for developers. It includes everything in the JRE plus the tools required to write and compile Java programs:

  • Compiler (javac): The JDK contains a compiler that turns human-readable Java code into bytecode.
  • Debugging Tools: It also provides debuggers and other tools to help check and fix code during development.
  • Complete Package for Developers: With the JDK, you have both the tools to create a program and the environment needed to run it.

How They Work Together

Image
  • When you write Java code, you use the JDK to compile it into bytecode.
  • The compiled bytecode is then run by the JVM, which is part of the JRE.
  • The JRE provides the libraries and environment necessary for the JVM to execute the program on your computer.

With a clear understanding of these components, you now know the roles of the JVM, JRE, and JDK in Java development and execution. This knowledge is crucial as you continue learning and working with Java applications.

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next