code: public static boolean isZos() {
  
          String os = AccessController.doPrivileged(new PrivilegedAction<String>() {
              @Override
              public String run() {
                  return System.getProperty("os.name");
              }
          });
  
          return os != null && (os.equalsIgnoreCase("OS/390") || os.equalsIgnoreCase("z/OS"));
      }
docs: In general find another way to do what you are trying, this is meant as a
  VERY VERY last resort and agreed to by Gary.