//取得操作系统相关信息
System.out.println( System.getProperty("os.name") );
System.out.println( System.getProperty("os.version") );
System.out.println( System.getProperty("os.arch") );
//对于操作系统的字符串请参照:http://lopica.sourceforge.net/os.html
未例代码:
String OS = System.getProperty("os.name").toLowerCase();
int pingTimes = 4;
String pingCommand = "";
if (OS.indexOf("windows")>=0) {
System.out.println("windows system");
} else {
System.out.println("other system");
}
System.out.println( System.getProperty("os.name") );
System.out.println( System.getProperty("os.version") );
System.out.println( System.getProperty("os.arch") );
//对于操作系统的字符串请参照:http://lopica.sourceforge.net/os.html
未例代码:
String OS = System.getProperty("os.name").toLowerCase();
int pingTimes = 4;
String pingCommand = "";
if (OS.indexOf("windows")>=0) {
System.out.println("windows system");
} else {
System.out.println("other system");
}