Table of Contents
- Introduction
-
JVM (Java Virtual Machine)
-
Architecture of the JVM
- Class Loader
-
JVM Memory
- Method Area
- Heap
- Stack Area
- Program Counter (PC) Register
- Native Method Stack
-
Execution Engine
- Interpreter
- Just-In-Time (JIT) Compiler
- Garbage Collector
-
Architecture of the JVM
-
JRE (Java Runtime Environment)
-
Key Components of the JRE
- Execution Tasks
- Class Libraries
- Java Native Interface (JNI)
- Security Manager
-
Key Components of the JRE
-
JDK (Java Development Kit)
-
Core Features of the JDK
- javac (Java Compiler)
- java (Java Application Launcher)
- jdb (Java Debugger)
- jar (Java Archive Tool)
- javadoc (Java Documentation Generator)
-
Core Features of the JDK
- JVM vs JRE vs JDK: What's the Difference?
- JDK, JRE, JVM Hierarchy
Introduction
The Java ecosystem is the broad set of tools, technologies, libraries, and frameworks that surround and support the Java programming language. It encompasses everything needed to develop, deploy, and manage Java applications. It revolves around JDK, JRE, JVM
JVM (Java Development Kit)
The JVM acts like a translator that allows your computer to run Java programs and other languages compiled into Java bytecode. It translates the code into something your computer's hardware can understand and execute.
Architecture of the JVM
Class Loader
Loading load
Load .class files into memory. Locates, loads, and links class files (Java bytecode) for execution.-
Linking
- Verification: Verifies the bytecode.
- Preparation: Allocates memory for static variables and initializes the memory to default values.
- Resolution: Resolves symbolic references to direct references.
Initialization
Initialization is the final step where the JVM prepares a class or interface for use. This step happens after the class has been loaded (into memory) and linked.
JVM Memory
-
Method Area
Method area Stores class-level data such as methods and variables, the runtime constant pool, and code for methods.
public class Person { private String name; public void setName(String name) { this.name = name; } }
When you define a class Person, the Method Area stores the structure of the Person class, including its methods (setName) and fields (name), and the runtime constant pool which contains references like method names and constant values.
-
Heap
Heap is where the runtime memory objects are allocated. The heap is shared among all threads and is where the garbage collection process occurs.
Person p = new Person();
When you create a new Person object, it is allocated on the Heap.
-
Stack Area
Stack area stores frames, which contain local variables, operand stacks, and references to the runtime constant pool of the class being executed. Each thread has its own stack.
public void someMethod() { int a = 10; int b = 20; int sum = a + b; }
Each time someMethod is called, a new frame is pushed onto the Stack Area. This frame includes local variables (a, b, and sum), an operand stack for intermediate calculations, and a reference to the method’s class in the Runtime Constant Pool.
Program Counter (PC) Register
PC contains the address of the current JVM instruction being executed. Each thread has its own PC register.Native Method Stack
Similar to the Java stack, but used for native methods.
Execution Engine
Interpreter
Interpreter reads Java bytecode and executes it line by line, converting each bytecode instruction into a sequence of machine-level instructions that can be executed by the CPU.Just-In-Time (JIT) Compiler
Converts bytecode into native machine code at runtime to improve performance.Garbage Collector
Garbage collector is responsible for automatically managing memory in the JVM. It identifies and deallocates memory that is no longer in use, freeing it up for new objects.
JRE
JRE is a software package that provides the necessary environment to run Java applications. It is designed to execute Java bytecode on a machine, making it an essential part of the "write once, run anywhere" (WORA) principle of Java.
public class Person {
private String name;
public void setName(String name) {
this.name = name;
}
}
Person p = new Person();
public void someMethod() {
int a = 10;
int b = 20;
int sum = a + b;
}
JDK (Java Development Kit)
│
├── JRE (Java Runtime Environment)
│ │
│ ├── JVM (Java Virtual Machine)
│ │ ├── Class Loader
│ │ ├── Bytecode Verifier
│ │ ├── Execution Engine
│ │ │ ├── Interpreter
│ │ │ ├── Just-In-Time (JIT) Compiler
│ │ │ └── Garbage Collector
│ │ └── Runtime Libraries (core libraries like java.lang, java.util, etc.)
│ │
│ └── Java APIs (Core libraries and additional libraries)
│
├── Development Tools (like javac, jdb, jar, javadoc, etc.)
└── Documentation (API docs, guides)
KeyComponentsoftheJRE
ExecutionTasks
TheJREfacilitatestheexecutionofJavaapplicationsbyprovidingtheJVMandthenecessarylibrariesandresources.JREensuresthattheJVMhaseverythingitneedstoperformthesetasksonanyplatform.ThinkoftheJREasthecompletepackagethatincludestheJVM,whichdoestheheavylifting,andothercomponentsthatsupporttheexecutionofJavaapplications.ClassLibraries
JREincludesasetofstandardJavaclasslibraries,whichprovidereusablecodeforperformingcommontasks,likedatastructures,I/O,networking,concurrency,andmore.JavaNativeInterface(JNI)
JNIallowsJavaapplicationstointeractwithnativecodewritteninlanguageslikeCorC++.Thisfeatureisessentialforintegratingplatform-specificfeaturesorusingexistingnativelibraries.SecurityManager
TheSecurityManagerenforcessecuritypoliciesforJavaapplications,restrictingactionssuchasfileaccess,networkconnections,andtheexecutionofpotentiallyunsafecode.
JDK(JavaDevelopmentKit)
JDKisatoolsthatenablesdeveloperstowrite,compile,debug,andrunJavaapplications.ItisasupersetofJREandincludesadditionaltoolsforJavadevelopment.
CoreFeaturesoftheJDK
javac(JavaCompiler)
javacisusetoforconvertingJavasourcecode(.javafiles)intobytecode(.classfiles).ThisbytecodeisthenexecutedbytheJavaVirtualMachine(JVM).java(JavaApplicationLauncher)
javacommandlaunchesaJavaapplication.Itloadsthenecessaryclassfiles,interpretsthebytecode,andstartstheapplication.jdb(JavaDebugger)
jdbisthecommand-linedebuggerforJavaprograms.ItallowsyoutoinspectanddebugJavaapplicationsatruntime.jar(JavaArchiveTool)
jartoolpackagesmultiplefilesintoasinglearchivefile,typicallywitha.jarextension.TheseJARfilesareusedtodistributeJavaapplicationsandlibraries.javadoc(JavaDocumentationGenerator)
javadocgeneratesHTMLdocumentationfromJavasourcecode,usingthespecial/***/commentsknownasdoccomments.
JVM vs JVE vs JDK, what's the difference?
Feature/Aspect | JVM | JRE | JDK |
---|---|---|---|
Purpose | Executes Java bytecode | Provides the environment to run Java applications | Provides tools to develop, compile, debug, and run Java applications |
Includes | JVM itself, which includes class loader, bytecode verifier, and execution engine | JVM + Core libraries (like java.lang, java.util, etc.), and other runtime components | JRE + Development tools (like javac, jdb, jar, etc.), documentation |
Components | - Class Loader - Bytecode Verifier - Execution Engine (Interpreter, JIT) |
- JVM - Core Java libraries - Java Plug-in - Java Web Start |
- JRE - Java Compiler (javac) - JAR Tool (jar) - Debugger (jdb) - Documentation Generator (javadoc) - Other development tools |
Main Functionality | Executes Java bytecode, enabling platform independence | Provides the minimum requirements to run Java applications | Allows developers to write, compile, and debug Java code |
Who Uses It? | End-users running Java applications | End-users running Java applications | Java developers writing and compiling Java applications |
Installation Size | Smallest | Larger than JVM but smaller than JDK | Largest (includes JRE and development tools) |
Developer Tools | No | No | Yes (includes compiler, debugger, profiler, etc.) |
Required to Run Java Programs | Yes | Yes | No (but needed to create Java programs) |
Platform Independence | Provides platform independence by abstracting the underlying hardware | Yes, because it includes the JVM | Yes, it includes everything from JRE |
Examples of Usage | - Running any Java application (e.g., desktop applications, servers) | - Running Java applications in production or end-user environments | - Writing and compiling Java code - Packaging applications - Debugging |
Availability | Part of JRE and JDK | Standalone or part of JDK | Standalone package |
JDK, JRE, JVM hierarchy
JDK (Java Development Kit) │ ├── JRE (Java Runtime Environment) │ │ │ ├── JVM (Java Virtual Machine) │ │ ├── Class Loader │ │ ├── Bytecode Verifier │ │ ├── Execution Engine │ │ │ ├── Interpreter │ │ │ ├── Just-In-Time (JIT) Compiler │ │ │ └── Garbage Collector │ │ └── Runtime Libraries (core libraries like java.lang, java.util, etc.) │ │ │ └── Java APIs (Core libraries and additional libraries) │ ├── Development Tools (like javac, jdb, jar, javadoc, etc.) └── Documentation (API docs, guides)
The above is the detailed content of Java Ecosystem Overview. For more information, please follow other related articles on the PHP Chinese website!

This article analyzes the top four JavaScript frameworks (React, Angular, Vue, Svelte) in 2025, comparing their performance, scalability, and future prospects. While all remain dominant due to strong communities and ecosystems, their relative popul

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

Node.js 20 significantly enhances performance via V8 engine improvements, notably faster garbage collection and I/O. New features include better WebAssembly support and refined debugging tools, boosting developer productivity and application speed.

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa

Iceberg, an open table format for large analytical datasets, improves data lake performance and scalability. It addresses limitations of Parquet/ORC through internal metadata management, enabling efficient schema evolution, time travel, concurrent w

This article addresses the CVE-2022-1471 vulnerability in SnakeYAML, a critical flaw allowing remote code execution. It details how upgrading Spring Boot applications to SnakeYAML 1.33 or later mitigates this risk, emphasizing that dependency updat

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

This article explores integrating functional programming into Java using lambda expressions, Streams API, method references, and Optional. It highlights benefits like improved code readability and maintainability through conciseness and immutability


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
