public class SystemUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HUTOOL_DATE_LENIENT
Hutool自定义系统属性:是否解析日期字符串采用严格模式
|
Constructor and Description |
---|
SystemUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
get(String key)
获得System属性
|
static String |
get(String name,
boolean quiet)
取得系统属性,如果因为Java安全的限制而失败,则将错误打在Log中,然后返回
null |
static String |
get(String name,
String defaultValue)
取得系统属性,如果因为Java安全的限制而失败,则将错误打在Log中,然后返回 defaultValue
|
static boolean |
getBoolean(String key,
boolean defaultValue)
获得boolean类型值
|
static int |
getInt(String key,
int defaultValue)
获得int类型值
|
static String[] |
getJavaClassPaths()
获得Java ClassPath路径,不包括 jre
|
static long |
getLong(String key,
long defaultValue)
获得long类型值
|
static Properties |
getProps() |
static String |
getQuietly(String key)
获得System属性,忽略无权限问题
|
static String |
getTmpDirPath()
获取临时文件路径(绝对路径)
|
static String |
getUserDirPath()
获取工作目录路径(绝对路径)
|
static String |
getUserHomePath()
获取用户路径(绝对路径)
|
static void |
set(String key,
String value)
设置系统属性,value为
null 表示移除此属性 |
public static final String HUTOOL_DATE_LENIENT
public static String get(String name, String defaultValue)
name
- 属性名defaultValue
- 默认值System.getProperty(String)
,
System.getenv(String)
public static String get(String key)
key
- 键System.getProperty(String)
,
System.getenv(String)
public static String getQuietly(String key)
key
- 键System.getProperty(String)
,
System.getenv(String)
public static String get(String name, boolean quiet)
null
name
- 属性名quiet
- 安静模式,不将出错信息打在System.err
中null
System.getProperty(String)
,
System.getenv(String)
public static boolean getBoolean(String key, boolean defaultValue)
key
- 键defaultValue
- 默认值public static int getInt(String key, int defaultValue)
key
- 键defaultValue
- 默认值public static long getLong(String key, long defaultValue)
key
- 键defaultValue
- 默认值public static Properties getProps()
public static void set(String key, String value)
null
表示移除此属性key
- 属性名value
- 属性值,null
表示移除此属性public static String[] getJavaClassPaths()
public static String getUserHomePath()
public static String getTmpDirPath()
public static String getUserDirPath()
Copyright © 2025. All rights reserved.