Oshi
Native Operating System and Hardware Information
Install / Use
/learn @oshi/OshiREADME

OSHI is a free JNA-based (native) Operating System and Hardware Information library for Java. It does not require the installation of any additional native libraries and aims to provide a cross-platform implementation to retrieve system information, such as OS version, processes, memory and CPU usage, disks and partitions, devices, sensors, etc.
- Supported Platforms
- Downloads and Dependency Management
- Documentation
- Usage
- Supported Features
- Support
- OSHI for Enterprise
- Security Contact Information
- Continuous Integration Test Status
- How Can I Help?
- Contributing to OSHI
- Acknowledgments
- License
Supported Platforms
- Windows
- macOS
- Linux (Android)
- UNIX (AIX, FreeBSD, OpenBSD, Solaris)
Documentation
- API (javadocs)
- FAQ
- Change Log
- Performance Considerations
- Major Version Breaking Changes
- Sample Output
- Applications and Projects using OSHI
Downloads and Dependency Management
Stable Release Version
- JDK8: oshi-core-6.10.0
- JPMS: oshi-core-java11-6.10.0
- FFM: oshi-core-java25-6.10.0
- JDK6: oshi-core-3.14.0
Current Development (SNAPSHOT) downloads
- JDK8: oshi-core-6.11.0-SNAPSHOT
- JPMS: oshi-core-java11-6.11.0-SNAPSHOT
- FFM: oshi-core-java25-6.11.0-SNAPSHOT
OSHI Java 25+ Module
A new module, oshi-core-java25, is now available.
- Purpose: This module intends to provide API-compatible implementations using the JDK Foreign Function & Memory (FFM) API, replacing JNA for native access over time with community contributions.
- Compatibility:
- Compiles on JDK 25+.
- Initial support is limited to operating systems with JDK 25 builds; broader OS support and migration of more native implementations will follow.
- Contributions are welcome and encouraged!
- Usage:
- Use this dependency in place of
oshi-core. - Import oshi.SystemInfoFFM instead of oshi.SystemInfo as the entry-point.
- All other imports (oshi.hardware., oshi.software.os.) remain unchanged.
- Use this dependency in place of
- Status:
- Some methods still delegate to legacy JNA-based internals until their FFM equivalents are implemented.
Usage
- Include OSHI and its dependencies on your classpath.
- We strongly recommend you add
oshi-coreas a dependency to your project dependency manager such as Maven or Gradle. - For Windows, consider the optional
jLibreHardwareMonitordependency if you need sensor information. Note the binary DLLs in this dependency are licensed under MPL 2.0. - For Android, you'll need to add the AAR artifact for JNA and exclude OSHI's transitive (JAR) dependency.
- See the FAQ if you encounter
NoClassDefFoundErrororNoSuchMethodErrorproblems.
- We strongly recommend you add
- Create a new instance of
SystemInfo - Use the getters from
SystemInfoto access hardware or operating system components, such as:
SystemInfo si = new SystemInfo(); // or new SystemInfoFFM() on java25 version
HardwareAbstractionLayer hal = si.getHardware();
CentralProcessor cpu = hal.getProcessor();
Sample Output
See SystemInfoTest.java for examples. To see sample output for your machine:
git clone https://github.com/oshi/oshi.git && cd oshi
./mvnw test-compile -pl oshi-core exec:java \
-Dexec.mainClass="oshi.SystemInfoTest" \
-Dexec.classpathScope="test"
Some settings are configurable in the oshi.properties file, which may also be manipulated using the GlobalConfig class or using Java System Properties. This should be done at startup, as configuration is not thread-safe and OSHI does not guarantee re-reading the configuration during operation.
The oshi-demo artifact includes several proof-of-concept examples of using OSHI to obtain information, including a basic Swing GUI.
You can run some of the demos using jbang:
# list all the aliases
jbang alias list oshi/oshi
# run the json demo
jbang json@oshi/oshi
#run the gui
jbang gui@oshi/oshi
Supported Features
- Computer System and firmware, baseboard
- Operating System and Version/Build
- Physical (core) and Logical (hyperthreaded) CPUs, processor groups, NUMA nodes
- System and per-processor load, usage tick counters, interrupts, uptime
- Process uptime, CPU, memory usage, user/group, command line args, thread details
- Physical and virtual memory used/available
- Mounted filesystems (type, usable and total space, options, reads and writes)
- Disk drives (model, serial, size, reads and writes) and partitions
- Network interfaces (IPs, bandwidth in/out), network parameters, TCP/UDP statistics
- Battery state (% capacity, time remaining, power usage stats)
- USB Devices
- Connected displays (with EDID info), graphics and audio cards
- Sensors (temperature, fan speeds, voltage) on some hardware
- Printers (name, status, driver)
Support
- For bug reports, feature requests, or general questions about OSHI's longer term plans, please create an issue.
- For help integrating OSHI into your own project or maintainer code review of your PRs, tag
@dbwiddisin issues or pull requests on your project site. - For "how to" questions regarding the use of the API, consult examples in the
oshi-demoproject, create an issue, or search on Stack Overflow using theoshitag, asking a new question if it hasn't been answered before. - To say thanks to OSHI's primary maintainer, you can sponsor him or buy him a coffee.
OSHI for Enterprise
Available as part of the Tidelift Subscription
The maintainers of OSHI and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.
Security Contact Information
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

