private Platform createPlatform(){
  Platform platform;
  try {
    String osName=System.getProperty("os.name");
    if (osName != null) {
      osName=osName.toLowerCase();
      logger.debug("os.name = {}",osName);
      if (osName.contains("windows")) {
        logger.debug("Detected Windows platform");
        platform=new WindowsPlatform();
      }
 else       if (osName.contains("solaris") || osName.contains("sunos") || osName.contains("linux")|| osName.contains("hp-ux")) {
        if (isGnome()) {
          logger.debug("Detected Gnome window manager on Posix platform");
          platform=new PosixGnomePlatform();
        }
 else         if (isKDE()) {
          logger.debug("Detected KDE window manager on Posix platform");
          platform=new PosixKDEPlatform();
        }
 else {
          logger.debug("Detected Posix platform");
          platform=new PosixPlatform();
        }
      }
 else       if (osName.contains("mac os x") || osName.contains("macos") || osName.contains("darwin")|| System.getProperty("mrj.version") != null) {
        logger.debug("Detected Mac OS X platform");
        platform=new MacOSXPlatform();
      }
 else {
        logger.warn("Unrecognized operating system: '{}', falling back to default platform",osName);
        platform=new DefaultPlatform();
      }
    }
 else {
      logger.warn("System property 'os.name' is null, falling back to default platform");
      platform=new DefaultPlatform();
    }
  }
 catch (  SecurityException e) {
    logger.warn("Not allowed to read system property 'os.name', falling back to default platform",e);
    platform=new DefaultPlatform();
  }
  return platform;
}

private Platform createPlatform ( ) { Platform platform ; try { String osName = System . getProperty ( "os.name" ) ; if ( osName != null ) { osName = osName . toLowerCase ( ) ; logger . debug ( "os.name = {}" , osName ) ; if ( osName . contains ( "windows" ) ) { logger . debug ( "Detected Windows platform" ) ; platform = new WindowsPlatform ( ) ; } else if ( osName . contains ( "solaris" ) || osName . contains ( "sunos" ) || osName . contains ( "linux" ) || osName . contains ( "hp-ux" ) ) { if ( isGnome ( ) ) { logger . debug ( "Detected Gnome window manager on Posix platform" ) ; platform = new PosixGnomePlatform ( ) ; } else if ( isKDE ( ) ) { logger . debug ( "Detected KDE window manager on Posix platform" ) ; platform = new PosixKDEPlatform ( ) ; } else { logger . debug ( "Detected Posix platform" ) ; platform = new PosixPlatform ( ) ; } } else if ( osName . contains ( "mac os x" ) || osName . contains ( "macos" ) || osName . contains ( "darwin" ) || System . getProperty ( "mrj.version" ) != null ) { logger . debug ( "Detected Mac OS X platform" ) ; platform = new MacOSXPlatform ( ) ; } else { logger . warn ( "Unrecognized operating system: '{}', falling back to default platform" , osName ) ; platform = new DefaultPlatform ( ) ; } } else { logger . warn ( "System property 'os.name' is null, falling back to default platform" ) ; platform = new DefaultPlatform ( ) ; } } catch ( SecurityException e ) { logger . warn ( "Not allowed to read system property 'os.name', falling back to default platform" , e ) ; platform = new DefaultPlatform ( ) ; } return platform ; }
tries to determine the platform we ' re running on based on java system properties and / or environment variables . see http : / / lopica . sourceforge . net / os . html for an overview .
