public class Test { public static void main(String... args) { System.out.println(System.getProperty("abc")); } }这样运行: java -Dabc=dffffgf Test就是设置了jdk属性
几个测试例子,帮助楼主理解一下!具体的建议楼主看看API文档!public class ShowProperties { public static void main(String[] args) { System.getProperties().list(System.out); System.out.println(System.getProperty("user.name")); System.out.println(System.getProperty("java.library.path")); System.out.println(new Date()); } }
public static void main(String... args) {
System.out.println(System.getProperty("abc"));
}
}这样运行:
java -Dabc=dffffgf Test就是设置了jdk属性
System.getProperties().list(System.out);
System.out.println(System.getProperty("user.name"));
System.out.println(System.getProperty("java.library.path"));
System.out.println(new Date());
}
}
而 "moduleID" 又不是系统默认的变量,为什么能取到值?谢谢。