Overview
Thejava.base module is the foundational module of the Java SE Platform. It defines essential APIs that all Java applications depend on. This module is implicitly required by all other modules.
Key Packages
The java.base module contains several critical packages that form the foundation of Java development:- Core Language
- Collections & Utilities
- I/O
java.lang Package
Provides classes fundamental to the design of the Java programming language:- Object - Root of the class hierarchy
- String - Immutable character sequences
- Class - Runtime class representation
- System - System facilities and standard I/O
- Thread - Concurrency primitives
- Math - Mathematical operations
Module Features
Service Providers
Service Providers
The java.base module provides implementations of several service provider interfaces:
- FileSystemProvider - jrt file system for run-time image access
- CharsetProvider - Character encoding providers
- SelectorProvider - Non-blocking I/O selectors
- TimeZoneNameProvider - Time zone naming
Module Dependencies
Module Dependencies
The java.base module is the root module and has no dependencies. All other modules implicitly depend on java.base:You never need to explicitly declare a dependency on java.base.
Platform Integration
Platform Integration
The module provides deep integration with the JVM and operating system:
- Native method support
- Reflection and introspection
- Class loading mechanisms
- Security manager integration
- System property access
- Environment variable access
Usage Example
Since java.base is implicit, you can use its APIs without any module declaration:Historical Notes
The java.base module was introduced in Java 9 as part of the Java Platform Module System (JPMS). It consolidates APIs that were previously part of the monolithic rt.jar in Java 8 and earlier.The java.base module is always present and accessible. It cannot be excluded from the module graph.
Related Documentation
- java.lang Package - Core language classes
- java.util Package - Collections and utilities
- java.io Package - Input/output operations