`

sun.misc.VM.getSavedProperty和System.getProperty的区别是什么

    博客分类:
  • jdk
 
阅读更多
java运行的设置:
-Djava.lang.Integer.IntegerCache.high=250
-Dhigh=250

public static void main(String[] args) {
		String a = sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
		String b = sun.misc.VM.getSavedProperty("high");
		String c = System.getProperty("java.lang.Integer.IntegerCache.high");
		String d = System.getProperty("high");
		System.err.println(a);
		System.err.println(b);
		System.err.println(c);
		System.err.println(d);
	}


结果:
250
250
null
250

为什么对于java.lang.Integer.IntegerCache.high这个设置的参数值用System.getProperty获取不到,但是用sun.misc.VM.getSavedProperty是可以获取到的?
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics