<span style="white-space:pre"> </span>Properties props=System.getProperties(); //系统属性
<span style="font-family: Arial, Helvetica, sans-serif;">System.out.println("操作系统的名称:"+props.getProperty("os.name"));</span>
if(props.getProperty("os.name").matches("^(?i)Windows.*$")){ //利用正则表达式忽略大小写
<span style="white-space:pre"> </span>//操作系统为windows
<span style="white-space:pre"> </span>}else{
<span style="white-space:pre"> </span>//操作系统为linux
<span style="white-space:pre"> </span>}