- What is
JRE
?- The JRE is the Java Runtime Environment. It is a package of everything necessary to run a compiled Java program, including the Java Virtual Machine (JVM), the Java Class Library, the Java command, and other infrastructure. However, it cannot be used to create new programs.
- What is
JDK
?- The JDK is the Java Development Kit, the full-featured SDK for Java.
- It has everything the JRE has, the compiler (javac) and tools (like javadoc and jdb).
Three major component
-
Class Loader
- Loading
- Bootstrap class loader
- Loads system jar
rt.jar
class to memory in theJRE/lib
folder.
- Loads system jar
- Extension class loader
- Makes precompiled class files available to JVM
- Application class loader
- Bootstrap class loader
- Linking
- Verify
- After class files are loaded in memory, there is a verify phase to check conformance to standard.
- Prepare
- In the preparation phase, memory for static variables memory is allocated.
- Resolve
- Symbolic references are replaced with actual references.
- Verify
- Initialization
- Static variables and init initialized
- Loading
-
Runtime Data Area
- PC Registers & Stacks per thread
-
Execution Engine
- Interpreter
- Converts instruction to machine code
- JIT
- Hotspot machine code cached
- Intermediate Code Generetor
- Code Optimizer
- Target code generetor
- Profiler
- Interpreter
-
The Java standard library needs to call into native code. For this purpose, the JRE contains some
.dll
(Windows).dylib
(macOS), or.so
(Linux) files underbin/
orlib/
with supporting, system-specific native binary code.