System.getProperty()方法获取系统变量
//获取系统变量,不存在该变量值,结果为null
String a=System.getProperty(“java.runtime.name”);
//获取系统变量,不存在该变量值,结果为默认值abc
String b=System.getProperty(“java.runtime.name”,“abc”);
//获取所有的系统变量
System.out.println(System.getProperties());
//获取系统变量,不存在该变量值,结果为null
String a=System.getProperty(“java.runtime.name”);
//获取系统变量,不存在该变量值,结果为默认值abc
String b=System.getProperty(“java.runtime.name”,“abc”);
//获取所有的系统变量
System.out.println(System.getProperties());