Class SystemInfo

java.lang.Object
oshi.nativefree.SystemInfo
All Implemented Interfaces:
SystemInfoProvider

public class SystemInfo extends Object implements SystemInfoProvider
Native-free SystemInfoProvider for Linux. Uses only procfs, sysfs, and standard Java APIs — no JNA, no FFM, no --enable-native-access required.

This provider is registered at priority 0 (lowest) and is only selected when no higher-priority provider (JNA or FFM) is available on the classpath.

See Also:
  • Constructor Details

    • SystemInfo

      public SystemInfo()
      Creates a new native-free Linux SystemInfo instance.
  • Method Details

    • getOperatingSystem

      public OperatingSystem getOperatingSystem()
      Description copied from interface: SystemInfoProvider
      Creates a new instance of the appropriate platform-specific OperatingSystem.
      Specified by:
      getOperatingSystem in interface SystemInfoProvider
      Returns:
      A new instance of OperatingSystem.
    • getHardware

      public HardwareAbstractionLayer getHardware()
      Description copied from interface: SystemInfoProvider
      Creates a new instance of the appropriate platform-specific HardwareAbstractionLayer.
      Specified by:
      getHardware in interface SystemInfoProvider
      Returns:
      A new instance of HardwareAbstractionLayer.
    • getPriority

      public int getPriority()
      Description copied from interface: SystemInfoProvider
      Returns the priority of this provider. Higher values indicate higher priority. When multiple providers are available, the one with the highest priority is selected.

      Priority 0 is reserved for a potential future no-native-access fallback. The JNA-based provider (oshi-core) returns 10. The FFM-based provider (oshi-core-ffm) returns 20 (preferred when available).

      Specified by:
      getPriority in interface SystemInfoProvider
      Returns:
      the priority of this provider
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: SystemInfoProvider
      Returns whether this provider is available in the current runtime environment.

      A provider may be unavailable if the current platform is not supported or if required runtime features (such as the FFM API on JDK 25+) are not present.

      Specified by:
      isAvailable in interface SystemInfoProvider
      Returns:
      true if this provider can be used in the current environment