Package oshi
package oshi
[oshi-core API] Provides a cross-platform implementation to retrieve Operating System and Hardware Information, such
as OS version, memory, CPU, disk, devices, sensors, etc.
Module Architecture
OSHI is organized into three modules:oshi-common(com.github.oshi.common) - Interfaces, abstract base classes, POJOs, and utilities. This module contains no native code and requires no native access permissions.oshi-core(this module) - Full OSHI implementation using JNA for native access. Supports all platforms (Windows, macOS, Linux, FreeBSD, OpenBSD, Solaris, AIX). Entry point:SystemInfo.oshi-core-java25- Alternative implementation using the Foreign Function and Memory (FFM) API (JDK 25+). Currently supports Windows, macOS, and Linux. Entry point:oshi.ffm.SystemInfo.
Native Access and JEP 472
Bothoshi-core and oshi-core-java25 use native access to retrieve most system information.
JEP 472 (JDK 24) causes the JVM to issue warnings when native code is
loaded, and a future JDK release will require the --enable-native-access flag to permit it.
Applications that cannot or prefer not to enable native access can depend on oshi-common alone. This module
provides the full OSHI API surface (interfaces and abstract base classes) along with utilities for parsing
/proc and other OS-provided text files, executing system commands, and formatting output. To use it:
- Depend on the
oshi-commonartifact only (Maven:com.github.oshi:oshi-common). - Extend the abstract base classes in
oshi.hardware.commonandoshi.software.common. For hardware, subclassAbstractHardwareAbstractionLayerand override itsprotected abstract create*()factory methods to return your platform-specific implementations. For software and individual components (e.g.,AbstractOperatingSystem,AbstractCentralProcessor), override theprotected abstract query*()methods with platform-specific logic using command-line tools,/procparsing, or other non-native techniques.
PlatformEnuminstead.