java: print out jvm properties

Print all jvm properties, including version, architecture, etc

 

 1 package com.my.test;
 2 
 3 import java.util.Properties;
 4 
 5 public class HelloWorld {
 6 
 7     /**
 8      * @param args
 9      */
10     public static void main(String[] args) {
11         //System.out.println("Hello World!");
12         Properties props= System.getProperties();
13         for(Object propKey : props.keySet()) {
14             if (!(propKey instanceof String)) {
15                 System.out.printf("Type of %s is %s\r\n", propKey.toString(), propKey.getClass().toString());
16             }
17             System.out.printf("Property[%s]=%s\r\n", propKey.toString(), props.get(propKey).toString());
18         }
19     }
20 

21 } 

posted on 2012-05-01 23:23  learner  阅读(287)  评论(0)    收藏  举报

导航