Skip to content

io microsphere util SystemUtils

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

SystemUtils

Type: Class | Module: microsphere-java-core | Package: io.microsphere.util | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/util/SystemUtils.java

Overview

The utilities class for System

Declaration

public abstract class SystemUtils implements Utils

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

Method Examples

copySystemProperties

SystemUtils.copySystemProperties();

getSystemProperty

String javaVersion = SystemUtils.getSystemProperty("java.version");

getSystemProperty

String customProperty = SystemUtils.getSystemProperty("my.custom.property", "default-value");

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.util.SystemUtils;

API Reference

Public Methods

Method Description
copySystemProperties The System property key for the Java class path : "java.class.path"
getSystemProperty
getSystemProperty

Method Details

copySystemProperties

public static void copySystemProperties()

The System property key for the Java class path : "java.class.path" / public static final String JAVA_CLASS_PATH_PROPERTY_KEY = "java.class.path";

/** The System property key for the User's account name : "user.name" / public static final String USER_NAME_PROPERTY_KEY = "user.name";

/** The System property key for the Path of extension directory or directories Deprecated. This property, and the mechanism which implements it, may be removed in a future release : "java.ext.dirs"

getSystemProperty

public static String getSystemProperty(String key)

Gets a system property with the given key, defaulting to null if the property cannot be read.

If a SecurityException is caught, the return value is null and a message is written to System.err.

Example Usage

`String javaVersion = SystemUtils.getSystemProperty("java.version");
`

getSystemProperty

public static String getSystemProperty(String key, String defaultValue)

Gets a system property with the given key, defaulting to the provided defaultValue if the property cannot be read.

If a SecurityException is caught while trying to access the system property, the method returns the specified default value and logs a warning message using the logger associated with this class.

Example Usage

`String customProperty = SystemUtils.getSystemProperty("my.custom.property", "default-value");
`

See Also

  • System

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally