JAVA INTERNALS: JDK, JRE, JVM, and JIT!
Source: Dev.to
What is JDK (Java Development Kit)?
The JDK provides the tools needed to write and develop Java programs.
When you write a program and compile it, the JDK uses the Java compiler (javac) to check for syntax errors and report them with line numbers. If no errors are found, the compiler converts the .java source file into a .class byte‑code file.
What is JRE (Java Runtime Environment)?
The JRE is required to run Java applications. It takes the compiled .class files and executes them on the system. The JRE also supplies the core libraries that the program needs while it is running.
What is JVM (Java Virtual Machine)?
- Converts bytecode into machine code.
- Manages memory (heap and stack).
- Executes the program, enabling Java’s “write once, run anywhere” (WORA) capability.
JIT (Just‑In‑Time Compiler)
The JIT compiler is part of the JVM’s execution engine. It converts bytecode into native machine code at runtime, improving performance and making Java programs run faster. While the interpreter executes code line‑by‑line, the JIT compiles frequently used code paths for speed.