根据System.getProperty("os.name")值得判断publicclassOS{publicenumPlatformEnum{MAC,LINUX,WINDOWS;私人静态平台枚举平台;publicstaticPlatformEnumplatform(){if(platform==null){Stringos=System.getProperty("os.name");StringosName=System.getProperty("os.name");System.out.println(osName);if(osName.startsWith("MacOS")){platform=PlatformEnum.MAC;}elseif(osName.startsWith("Windows")){platform=PlatformEnum.WINDOWS;}else{platform=PlatformEnum.LINUX;}}返回平台;}}
