当前位置 : 主页 > 编程语言 > c++ >

java获取当前运行时信息

来源:互联网 收集:自由互联 发布时间:2021-07-03
sysinfo_properties.java package systeminfo; import java.util.Iterator;import java.util.Map.Entry;import java.util.Properties; public class sysinfo { public static void main(String[] args) { Properties p = System.getProperties(); Iterator it
sysinfo_properties.java
package systeminfo;
 
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Properties;
 
 
public class sysinfo {
 
    public static void main(String[] args) {
        Properties p = System.getProperties();
        Iterator
 
  > it= p.entrySet().iterator();
        while(it.hasNext()){
            Entry
  
    item=it.next(); System.out.print(item.getKey()+"==="); System.out.println(item.getValue()); } } }
  
 
sysinfo_easyString.java
package systeminfo;
public class sysinfo {
 
    public static void main(String[] args) {
        String s = System.getProperties().toString();
        System.out.println(s);
        }
}
sysinfo_StringSplited.java
package systeminfo;
 
 
public class sysinfo {
 
    public static void main(String[] args) {
         
        String s = System.getProperties().toString();
        System.out.println(s);
         
        String[] ss=s.split(",");
        for(String e:ss){
        System.out.println(e);
        }
    }
 
}
网友评论