java 如何判断操作系统是Linux还是Windows
展开全部
public static void main(String[] args) {
System.out.println("current system environment variable:");
Map<String,String> map = System.getenv();
Set<Map.Entry<String,String>> entries = map.entrySet();
for (Map.Entry<String, String> entry : entries) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
System.out.println("---------------");
System.out.println("current system properties:");
Properties properties = System.getProperties();
Set<Map.Entry<Object, Object>> set = properties.entrySet();
for (Map.Entry<Object, Object> objectObjectEntry : set) {
System.out.println(objectObjectEntry.getKey() + ":" + objectObjectEntry.getValue());
}
}
System.out.println("current system environment variable:");
Map<String,String> map = System.getenv();
Set<Map.Entry<String,String>> entries = map.entrySet();
for (Map.Entry<String, String> entry : entries) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
System.out.println("---------------");
System.out.println("current system properties:");
Properties properties = System.getProperties();
Set<Map.Entry<Object, Object>> set = properties.entrySet();
for (Map.Entry<Object, Object> objectObjectEntry : set) {
System.out.println(objectObjectEntry.getKey() + ":" + objectObjectEntry.getValue());
}
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询