zoukankan      html  css  js  c++  java
  • 获取当前的系统类型

    package com.hncy.common;
    
    
    public class OutSystemType {
    private static String OS = System.getProperty("os.name").toLowerCase();  
        
        private static OutSystemType _instance = new OutSystemType();  
          
        private EPlatformUtils platform;  
          
        private OutSystemType(){}  
          
        public static boolean isLinux(){  
            return OS.indexOf("linux")>=0;  
        }  
          
        public static boolean isMacOS(){  
            return OS.indexOf("mac")>=0&&OS.indexOf("os")>0&&OS.indexOf("x")<0;  
        }  
          
        public static boolean isMacOSX(){  
            return OS.indexOf("mac")>=0&&OS.indexOf("os")>0&&OS.indexOf("x")>0;  
        }  
          
        public static boolean isWindows(){  
            return OS.indexOf("windows")>=0;  
        }  
          
        public static boolean isOS2(){  
            return OS.indexOf("os/2")>=0;  
        }  
          
        public static boolean isSolaris(){  
            return OS.indexOf("solaris")>=0;  
        }  
          
        public static boolean isSunOS(){  
            return OS.indexOf("sunos")>=0;  
        }  
          
        public static boolean isMPEiX(){  
            return OS.indexOf("mpe/ix")>=0;  
        }  
          
        public static boolean isHPUX(){  
            return OS.indexOf("hp-ux")>=0;  
        }  
          
        public static boolean isAix(){  
            return OS.indexOf("aix")>=0;  
        }  
          
        public static boolean isOS390(){  
            return OS.indexOf("os/390")>=0;  
        }  
          
        public static boolean isFreeBSD(){  
            return OS.indexOf("freebsd")>=0;  
        }  
          
        public static boolean isIrix(){  
            return OS.indexOf("irix")>=0;  
        }  
          
        public static boolean isDigitalUnix(){  
            return OS.indexOf("digital")>=0&&OS.indexOf("unix")>0;  
        }  
          
        public static boolean isNetWare(){  
            return OS.indexOf("netware")>=0;  
        }  
          
        public static boolean isOSF1(){  
            return OS.indexOf("osf1")>=0;  
        }  
          
        public static boolean isOpenVMS(){  
            return OS.indexOf("openvms")>=0;  
        }  
          
        /** 
         * 获取操作系统名字 
         * @return 操作系统名 
         */  
        public static EPlatformUtils getOSname(){  
            if(isAix()){  
                _instance.platform = EPlatformUtils.AIX;  
            }else if (isDigitalUnix()) {  
                _instance.platform = EPlatformUtils.Digital_Unix;  
            }else if (isFreeBSD()) {  
                _instance.platform = EPlatformUtils.FreeBSD;  
            }else if (isHPUX()) {  
                _instance.platform = EPlatformUtils.HP_UX;  
            }else if (isIrix()) {  
                _instance.platform = EPlatformUtils.Irix;  
            }else if (isLinux()) {  
                _instance.platform = EPlatformUtils.Linux;  
            }else if (isMacOS()) {  
                _instance.platform = EPlatformUtils.Mac_OS;  
            }else if (isMacOSX()) {  
                _instance.platform = EPlatformUtils.Mac_OS_X;  
            }else if (isMPEiX()) {  
                _instance.platform = EPlatformUtils.MPEiX;  
            }else if (isNetWare()) {  
                _instance.platform = EPlatformUtils.NetWare_411;  
            }else if (isOpenVMS()) {  
                _instance.platform = EPlatformUtils.OpenVMS;  
            }else if (isOS2()) {  
                _instance.platform = EPlatformUtils.OS2;  
            }else if (isOS390()) {  
                _instance.platform = EPlatformUtils.OS390;  
            }else if (isOSF1()) {  
                _instance.platform = EPlatformUtils.OSF1;  
            }else if (isSolaris()) {  
                _instance.platform = EPlatformUtils.Solaris;  
            }else if (isSunOS()) {  
                _instance.platform = EPlatformUtils.SunOS;  
            }else if (isWindows()) {  
                _instance.platform = EPlatformUtils.Windows;  
            }else{  
                _instance.platform = EPlatformUtils.Others;  
            }  
            return _instance.platform;  
        }  
        /** 
         * @param args 
         */  
        public static EPlatformUtils outSystemType(){
            return OutSystemType.getOSname();
        } 
    }

    这个能获取到系统类型
    OutSystemType.outSystemType().toString()获取到系统类型
  • 相关阅读:
    asp.net中3个常用的功能,直接上代码
    看WEB 2.0实战书中的部分技术资料 引用 很随笔,很杂乱
    Building a Web 2.0 Portal with ASP.NET 3.5(DropThings实例教学)
    如何防治猪流感!猪流感!?会像SARS那样爆发吗?我们能作的就是预防。
    招聘!北京 DNN程序员 5K7K
    国外的机器人爱好者使用C#等研发的一种家庭灭火机器人
    OLAP与OLTP的区别 及 什么是数据仓库
    动态绑定数据源的ReportViewer终于搞定了
    牛奶再次出事?!算了,我还是自己榨豆浆吧。中国人喝豆浆!
    c#遍历HashTable
  • 原文地址:https://www.cnblogs.com/handbang/p/Spring.html
Copyright © 2011-2022 走看看