获取系统版本,判断是windows还是Linux
2021-06-30 07:05
标签:none sys bin ble The hide pac textarea padding 获取系统版本,判断是windows还是Linux 标签:none sys bin ble The hide pac textarea padding 原文地址:https://www.cnblogs.com/gz9218/p/4002bbdf3490bb98a48ab866287f8f19.htmlpackage com.foresee.zxpt.common.utils;
import java.util.Properties;
/**
* 获取系统版本
* @author GZ
*
*/
public class OSUtils {
/**
* 判断是否是Linux
* @return
*/
public static boolean isOSLinux() {
Properties prop = System.getProperties();
String os = prop.getProperty("os.name");
if (os != null && os.toLowerCase().indexOf("linux") > -1) {
return true;
} else {
return false;
}
}
/**
* 判断是否是windows
* @return
*/
public static boolean isOSWin() {
Properties prop = System.getProperties();
String os = prop.getProperty("os.name");
if (os != null && os.toLowerCase().startsWith("win")) {
return true;
} else {
return false;
}
}
}
String os = prop.getProperty("os.name");
package com.foresee.zxpt.common.utils;
import java.util.Properties;
/**
* 获取系统版本
* @author GZ
*
*/
public class OSUtils {
/**
* 判断是否是Linux
* @return
*/
public static boolean isOSLinux() {
Properties prop = System.getProperties();
String os = prop.getProperty("os.name");
if (os != null && os.toLowerCase().indexOf("linux") > -1) {
return true;
} else {
return false;
}
}
/**
* 判断是否是windows
* @return
*/
public static boolean isOSWin() {
Properties prop = System.getProperties();
String os = prop.getProperty("os.name");
if (os != null && os.toLowerCase().startsWith("win")) {
return true;
} else {
return false;
}
}
}
文章标题:获取系统版本,判断是windows还是Linux
文章链接:http://soscw.com/index.php/essay/99731.html