zoukankan      html  css  js  c++  java
  • 获取系统版本,判断是windows还是Linux

    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;
    		}
    	}
    }
    
  • 相关阅读:
    Java日期相关操作
    Java中this的功能与作用
    DCL双检查锁机制实现的线程安全的单例模式
    Java 二分查找
    Java冒泡排序
    Java多线程编程(二)
    SSH小结
    Python快速上手JSON指南
    趣谈、浅析CRLF和LF
    linux开发神器--Tmux
  • 原文地址:https://www.cnblogs.com/gz9218/p/4002bbdf3490bb98a48ab866287f8f19.html
Copyright © 2011-2022 走看看