public static void main(String[] args) throws Exception {
    try (Writer out = new BufferedWriter(new OutputStreamWriter(System.out,
                                                                StandardCharsets.UTF_8))) {
      for (Map.Entry<String, String> each : System.getenv().entrySet()) {
        // On Windows, the environment may include variables that start with '=' (https://stackoverflow.com/questions/30102750).
        // Such variables break the output parser and are unimportant, hence are filtered out.
        if (each.getKey().startsWith("=")) continue;

        out.write(each.getKey());
        out.write('=');
        out.write(each.getValue());
        out.write('\0');
      }
    }
  }
public static void main(String[] args)