How does the compiler works?How does the compiler works?

How is it actually work?

Java is a language with a complex internal structure. Let's delve into the internals of Java and briefly understand how everything is organized.


Java Virtual Machine or JVM is a software engine that executes Java bytecode. It acts as a virtual computer that interprets and runs Java programs. JVM is responsible for translating Java bytecode, which is platform-independent, into machine-specific instructions that can be understood by the underlying operating system. It provides a layer of abstraction between the Java program and the hardware, allowing Java programs to run on different platforms without the need for recompilation. In simple terms, JVM is like a virtual computer that enables the execution of Java programs on different systems.


If we explain bytecode very briefly, it is the code that is used by our virtual machine to be understood by any device.

The most important thing to understand now is that this is how Java achieves its famous cross-platform compatibility and flexibility.


The Java Runtime Environment (JRE) is a software package that provides the necessary tools and libraries to run Java programs. It includes the Java Virtual Machine (JVM), which is responsible for executing the bytecode of Java programs, and a set of core libraries and runtime components. The JRE allows you to run Java applications on your computer without needing to compile the source code.

In simple terms, it's the environment that enables you to run Java programs on your system.


The Java Development Kit (JDK) is a software package that provides the necessary tools and resources for developing Java applications. It includes the Java compiler, which translates human-readable Java source code into bytecode that can be executed by the Java Virtual Machine (JVM). The JDK also includes various libraries, development tools, and documentation that assist in the creation, testing, and debugging of Java programs.

In simple terms, it's a package that allows you to write, compile, and build Java applications.


In Java, libraries are a collection of objects, methods, and classes written by the creators of Java - Oracle. We will later explore what they are and how to import them into our code. For now, it's important to remember that they are located in the JRE (Java Runtime Environment).


The compiler - in simple terms, it is the tool that compiles our code, meaning it executes it from the text we have written in the editor (in the development environment).


The debugger - is a tool that helps easily find and solve errors in the code. We will delve into it in more detail and learn how to use it in a separate course.


I understand that this may seem difficult to grasp, but this information is important for understanding how the programming language perceives everything from its perspective.

This is also the main reason why the compiler takes so long to work. Due to all this structure, sometimes the code can take 10-15 seconds to compile.


Because the compiler is located in the JDK (Java Development Kit), it is impossible to write drivers in Java because JDK requires drivers to function properly.

1. What is the role of JVM in Java?
2. What does JRE stand for?
3. Which package includes the Java compiler and development tools?


What is the role of JVM in Java?

Select the correct answer


What does JRE stand for?

Select the correct answer


Which package includes the Java compiler and development tools?

Select the correct answer

Everything was clear?

Section 1. Chapter 1