   public Environment()
      throws IOException
   {
      String command = null;
      String OS = System.getProperty("os.name");
      String lowerOs = OS.toLowerCase();
      if (OS.indexOf("Windows") > -1) {
         command = "cmd /C set";
      } else if (OS.indexOf("ix") > -1 || OS.indexOf("inux") > -1) {
         command = "env";
      } else if(lowerOs.startsWith("mac os x")) {
         command = "env";
      } else {
      }
      if (command == null) {
         throw new RuntimeException("Operating system " + OS
            + " not supported by this class");
      }
      Process pid = Runtime.getRuntime().exec(command);
      BufferedReader in =
         new BufferedReader(
         new InputStreamReader(
         pid.getInputStream()));
      while(true) {
         String line = in.readLine();
         if (line == null)
            break;
         int p = line.indexOf("=");
         if (p != -1) {
            String name = line.substring(0, p);
            String value = line.substring(p+1);
            setProperty(name, value);
         }
      }
      in.close();
      try {
         pid.waitFor();
      }
      catch (InterruptedException e) {
         throw new IOException(e.getMessage());
      }
   }

   public Environment()
      throws IOException
   {
      String command = null;
      String OS = System.getProperty("os.name");
      String lowerOs = OS.toLowerCase();
      if (OS.indexOf("Windows") > -1) {
         command = "cmd /C set";
      } else if (lowerOs.indexOf("ix") > -1 || lowerOs.indexOf("linux") > -1 
        || lowerOs.indexOf("freebsd") > -1
        || lowerOs.indexOf("sunos") > -1 || lowerOs.indexOf("solaris") > -1
        || lowerOs.indexOf("hp-ux") > -1) {
         command = "env";
      } else if(lowerOs.startsWith("mac os x")) {
         command = "env";
      } else {
      }
      if (command == null) {
         throw new RuntimeException("Operating system " + OS
            + " not supported by this class");
      }
      Process pid = Runtime.getRuntime().exec(command);
      BufferedReader in =
         new BufferedReader(
         new InputStreamReader(
         pid.getInputStream()));
      while(true) {
         String line = in.readLine();
         if (line == null)
            break;
         int p = line.indexOf("=");
         if (p != -1) {
            String name = line.substring(0, p);
            String value = line.substring(p+1);
            setProperty(name, value);
         }
      }
      in.close();
      try {
         pid.waitFor();
      }
      catch (InterruptedException e) {
         throw new IOException(e.getMessage());
      }
   }
