{"record":{"id":"f5cb78dafa851c8b","repo":"apache/hadoop","slug":"operating-system-not-supported-by-this-class","errorCode":null,"errorMessage":"Operating system {} not supported by this class","messagePattern":"Operating system (.+?) not supported by this class","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-streaming/src/main/java/org/apache/hadoop/streaming/Environment.java","lineNumber":61,"sourceCode":"    // environments that you expect to run in\n    // http://lopica.sourceforge.net/os.html\n    String command = null;\n    String OS = System.getProperty(\"os.name\");\n    String lowerOs = StringUtils.toLowerCase(OS);\n    if (OS.indexOf(\"Windows\") > -1) {\n      command = \"cmd /C set\";\n    } else if (lowerOs.indexOf(\"ix\") > -1 || lowerOs.indexOf(\"linux\") > -1\n               || lowerOs.indexOf(\"freebsd\") > -1 || lowerOs.indexOf(\"sunos\") > -1\n               || lowerOs.indexOf(\"solaris\") > -1 || lowerOs.indexOf(\"hp-ux\") > -1) {\n      command = \"env\";\n    } else if (lowerOs.startsWith(\"mac os x\") || lowerOs.startsWith(\"darwin\")) {\n      command = \"env\";\n    } else {\n      // Add others here\n    }\n\n    if (command == null) {\n      throw new RuntimeException(\"Operating system \" + OS + \" not supported by this class\");\n    }\n\n    // Read the environment variables\n\n    Process pid = Runtime.getRuntime().exec(command);\n    BufferedReader in = new BufferedReader(\n        new InputStreamReader(pid.getInputStream(), StandardCharsets.UTF_8));\n    try {\n      while (true) {\n        String line = in.readLine();\n        if (line == null)\n          break;\n        int p = line.indexOf(\"=\");\n        if (p != -1) {\n          String name = line.substring(0, p);\n          String value = line.substring(p + 1);\n          setProperty(name, value);\n        }","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-streaming/src/main/java/org/apache/hadoop/streaming/Environment.java#L43-L79","documentation":"hadoop-streaming's Environment class discovers how to dump environment variables by matching the os.name property: Windows uses 'cmd /C set', unix-likes (names containing ix/linux/freebsd/sunos/solaris/hp-ux) and macOS use 'env'. If os.name matches none of these, command stays null and the constructor throws RuntimeException 'Operating system <OS> not supported by this class'.","triggerScenarios":"Running a streaming job on the client/task side under an OS whose os.name isn't covered — e.g. z/OS, OpenVMS, OS/2, or an exotic JVM reporting an unexpected os.name — so Environment cannot choose a dump command and fails at construction.","commonSituations":"Legacy mainframes or niche platforms (z/OS) running the streaming client, JVMs/localized systems reporting unusual os.name values, or unit tests that manipulate os.name; commonly surfaces as an immediate RuntimeException during job setup rather than during data processing.","solutions":["Run the streaming job on a supported platform (Linux, macOS, Windows, Solaris/HP-UX/AIX-style unix)","Avoid code paths that need Environment dumping: pass variables via job configuration (stream.addenvironment) instead of relying on inherited env detection","Patch Environment.java locally to recognize the platform and contribute it upstream","On the offending OS, run streaming under a compatibility layer (e.g. z/OS Unix System Services reporting a matched name)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// preflight: only use streaming's Environment on platforms it recognizes\nString os = System.getProperty(\"os.name\", \"\").toLowerCase(Locale.ROOT);\nboolean supported = os.contains(\"windows\") || os.contains(\"ix\") || os.contains(\"linux\")\n    || os.contains(\"freebsd\") || os.contains(\"sunos\") || os.contains(\"solaris\")\n    || os.contains(\"hp-ux\") || os.startsWith(\"mac os x\") || os.startsWith(\"darwin\");\nif (!supported) { /* route around Environment */ }","typeGuard":null,"tryCatchPattern":"try { env = new Environment(); } catch (RuntimeException e) { /* fall back to System.getenv() and pass needed vars explicitly via job config (stream.addenvironment) */ }","preventionTips":["Pass required variables through job configuration instead of relying on runtime env dumping","Keep streaming jobs on supported platforms (Linux/macOS/Windows)","If a niche platform is mandatory, patch Environment.java and upstream the change"],"tags":["hadoop-streaming","platform-support","environment-variables","os-detection"],"backgroundTag":"unsupported-platform","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}