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;
}
}
}
x
42
        String os = prop.getProperty("os.name");
 
1
package com.foresee.zxpt.common.utils;
2

3
import java.util.Properties;
4

5
/**
6
 * 获取系统版本
7
 * @author GZ
8
 *
9
 */
10
public class OSUtils {
11

12
    /**
13
     * 判断是否是Linux
14
     * @return
15
     */
16
    public static boolean isOSLinux() {
17
        Properties prop = System.getProperties();
18

19
        String os = prop.getProperty("os.name");
20
        if (os != null && os.toLowerCase().indexOf("linux") > -1) {
21
            return true;
22
        } else {
23
            return false;
24
        }
25
    }
26
    
27
    /**
28
     * 判断是否是windows
29
     * @return
30
     */
31
    public static boolean isOSWin() {
32
        Properties prop = System.getProperties();
33
        
34
        String os = prop.getProperty("os.name");
35
        if (os != null && os.toLowerCase().startsWith("win")) {
36
            return true;
37
        } else {
38
            return false;
39
        }
40
    }
41
}
42

获取系统版本,判断是windows还是Linux的更多相关文章

  1. Windows 系统版本判断

    Windows 系统版本判断 博客分类: C/C++   很多情况下,需要软件判断操作系统,其实网上写的都很少,我希望这篇文章能给大家帮助 首先我们要在.h中定义下面的东西 #define PRODU ...

  2. windows平台下 c++获取 系统版本 网卡 内存 CPU 硬盘 显卡信息<转>

    GetsysInfo.h: #ifndef _H_GETSYSINFO #define _H_GETSYSINFO #pragma once #include <afxtempl.h> c ...

  3. BesLyric 全新版本下载 ( windows \ mac \ linux )

    导读 BesLyric , 一款专门制作 网易云音乐 LRC 滚动歌词的软件! 搜索.下载.制作 歌词更方便! 很荣幸地,自 beslyric 2017 年开发推出以来,得到了很多云村村民的肯定,现在 ...

  4. c# 获取系统版本,获取net framework 版本(Environment 类)

    1.获取当前操作系统版本信息 使用Environment.OSVersion 属性 获取包含当前平台标识符和版本号的 OperatingSystem 对象. 命名空间:  System程序集:  ms ...

  5. [完美]原生JS获取浏览器版本判断--支持Edge,IE,Chrome,Firefox,Opera,Safari,以及各种使用Chrome和IE混合内核的浏览器

    截至自2017-08-11,支持现世已出的几乎所有PC端浏览器版本判断. 受支持的PC端浏览器列表: Edge IE Chrome Firefox Opera Safari QQ浏览器 360系列浏览 ...

  6. 【转】通过js获取系统版本以及浏览器版本

    function getOsInfo() { var userAgent = navigator.userAgent.toLowerCase(); var name = 'Unknown'; var ...

  7. python实现获取系统版本和mac信息上传到指定接口

    import os,platform,uuid,urllib.parse,urllib.request,json def BeforeSystemRequests(): ''' the systemi ...

  8. DELPHI FMX 获取系统版本 ANDROID IOS通用

    引用System.sysutils function getOSInfo:String; begin result:= fomrat('%s:%d.%d', TOSVersion.Name,TOSVe ...

  9. python学习 —— 获取系统运行情况信息并在Linux下设置定时运行python脚本

    代码: # -*- coding:utf-8 -*- from psutil import * def cpu_usage_rate(): for i, j in zip(range(1, cpu_c ...

随机推荐

  1. DVWA靶场之XSS(Reflected)通关

    反射型xss Low: <?php header ("X-XSS-Protection: 0"); // Is there any input? if( array_key_ ...

  2. HCNA Routing&Switching之广域网协议HDLC和PPP

    前文我们了解了地址转换技术NAT相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15168042.html:今天我们来聊一聊广域网中的两个二层封装协议H ...

  3. 【springboot】集成Druid 作为数据库连接池

    转自:https://blog.csdn.net/cp026la/article/details/86508139 1. 引言 用户的每一次请求几乎都会访问数据库,访问数据库需要向数据库获取链接,而数 ...

  4. leaflet 动态线渲染

    可以采用leaflet插件 leaflet-ant-path ... <script src="js/leaflet-ant-path.js" type="text ...

  5. axios 请求数据跳转页面报'$router' of undefined问题

    代码: this.$axios.post("/auth", { 'username': this.username, 'password': this.password }).th ...

  6. IO异常--缓冲流--转换流--序列化流( IO流2 )

    1.IO异常的处理 JDK7前处理:使用try...catch...finally 代码块,处理异常部分 // 声明变量 FileWriter fw = null; try { //创建流对象 fw ...

  7. 使用filter过滤GZIP压缩(二)

    在代码之前,讲一下用filter实现GZIP压缩的原理: 因为GZIP压缩之后,是从服务器端传输到浏览器端,从servlet到浏览器(从jsp到浏览器),其实是response带回内容,所以我们要在f ...

  8. Spring之JDBC Template

    时间:2017-2-5 18:16 --Spring对不同持久化技术的支持Spring为各种支持的持久化技术都提供了简单操作的模板和回调.ORM持久化技术:    JDBC:        org.s ...

  9. Acwing 883高斯消元法的运用

    Acwing 883高斯消元法的运用 解线性方程组 Acwing 883 输入一个包含 n 个方程 n 个未知数的线性方程组. 方程组中的系数为实数. 求解这个方程组. 下图为一个包含 m 个方程 n ...

  10. Qt5之坐标系统

    窗口坐标为逻辑坐标,是基于视口坐标系的. 视口坐标为物理坐标,是基于绘图设备坐标系的 窗口坐标始终以视口坐标为最终目标进行映射: QPainter::setWindow 修改了窗口位置和大小(左上角重 ...