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. SQL 练习28

    查询平均成绩大于等于 85 的所有学生的学号.姓名和平均成绩 SELECT Student.SId,Student.Sname,平均成绩 FROM Student , (SELECT sid,AVG( ...

  2. sentinel安装

    sentinel介绍 随着微服务的流行,服务和服务之间的稳定性变得越来越重要.Sentinel 以流量为切入点,从流量控制.熔断降级.系统负载保护等多个维度保护服务的稳定性. Sentinel 具有以 ...

  3. TP6 服务器响应500时没有错误信息的解决方案

    重点!!!! 首先,确认你的电脑管理员账户是否含有中文!!!!!!就像下面这种:所以出现了没有错误提示    查看nginx日志显示\vendor\topthink\framework\src\thi ...

  4. redisson 分布式加锁

    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring- ...

  5. Linux 替换^M字符

    Linux 替换^M字符 在Linux下使用vim 来查看一些在Windows下创建的文本文件,有时会发现在行尾有一些"^M". 1.使用dos2unix命令.一般的分发版本中都带 ...

  6. 虚拟机--第二章java内存区域与内存溢出异常--(抄书)

    这是本人阅读周志明老师的<深入理解Java虚拟机>第二版抄写的,有很多省略,不适合直接阅读,需要阅读请出门左转淘宝,右转京东,支持周老师(侵权请联系删除) 第二章java内存区域与内存溢出 ...

  7. Mac Ideal 常用快捷键

    智能提示 ⌘ -> command ⇧ -> shift ⌥ -> option -> 上箭头 -> 下箭头 ⌃ -> Control mac的option键  = ...

  8. 优先队列PriorityQueue&Lambda&Comparator

    今天翻阅<Labuladuo的算法小抄>时发现在使用优先队列的PriorityQueue解决一道hard题时(leetCode 23),出现了如下代码: ListNode mergeKLi ...

  9. MySQL-LSN

    查看lsn:   show engine innodb status Log sequence number 2687274848548    Log flushed up to 2687274848 ...

  10. elasticsearch支持大table格式数据的搜索

    一.问题源起 数据情况 TableMeta, 保存table的元数据,通过fileId关联具体的GridFS文件: id name creator fileId 1 table1 mango f1 2 ...