DEV Community

Dinesh G
Dinesh G

Posted on

Architecture of Java

What is Java Architecture

Java Architecture is the framework that allows Java program to run on any devices or platform built around the core components of the JVM,JDK,JRE.

Java architecture explains how a Java program runs — starting from source code to the final output.

It mainly involves three components: JDK (Java Development Kit), JRE (Java Runtime Environment), and JVM (Java Virtual Machine).

When we write Java code, the compiler converts it into bytecode, which is platform independent.

This bytecode is then executed by the JVM, which converts it into machine code for the specific operating system.

This is what makes Java platform-independent and portable.

Compiler:

A compiler is a program that translates the human-readable source code into bytecode

The "javac" command that you generally use to compile high level java code to a .class file or bytecode, is actually surprisingly written in java. This is known as a bootstrap compiler or a "self compiling compiler". It's a compiler written for a language in that language.

javac - read Java class and interface definitions and compile them into bytecode and class files

JVM - (Java Virtual Machine)

JVM stands for java virtual machine.

it is a software layer that runs bytecode java program by converting byte code into machine code .

The JVM is platform-dependent, meaning a specific JVM implementation exists for each operating system (e.g., Windows, macOS, Linux).

Why?

  • it makes java platform independent
  • it manages memory automatically
  • it executes and optimizes the code

JDK - (Java Development Kit)

Java Development Kit

JDK contains all the tools that are required to compile,debug and run a program developed using the java program .

Java Development Kit is a software development environment that includes JRE and development tools. It's used to create Java applications and applets. JDK includes tools like a compiler, debugger, and documentation generator.

These development tools include the Java compiler (javac), debugger, Javadoc tool, and other utilities necessary for writing, compiling, and debugging Java programs.

JRE - (Java Runtime Environment)

Java Runtime Environment

JRE is a set of software tools responsible for execution of the java program or application on your system.

Java Runtime Environment is a set of software tools that provides a runtime environment for running other software. It's used to run Java applications. JRE contains class libraries, supporting files, and the JVM.

The JRE is designed for users who only need to run Java applications and do not require development tools.

For example,

we write a code called first.
In other programming languages like C or C++ it is directly converted into binary. But in java it is converted into .class file also known as byte code which is an intermediary file and then into
binary.

  • JVM: is the engine that executes Java bytecode, ensuring platform independence.
  • JRE: is the environment required to run Java applications, containing the JVM and necessary libraries.
  • JDK: is the complete toolkit for developing Java applications, encompassing the JRE and development tools

Top comments (0)