code: private static int readEnvironment( String cmdExec, Properties properties )
      {
          // fire up the shell and get echo'd results on stdout
          BufferedReader reader = null;
          Process process = null;
          int exitValue = 99;
          try
          {
              String[] args = new String[]{ cmdExec };
              process = startProcess( args );
              reader = createReader( process );
              processLinesOfEnvironmentVariables( reader, properties );
              process.waitFor();
              reader.close();
          }
          catch( InterruptedException t )
          {
              throw new EnvironmentException( "NA", t );
          }
          catch( IOException t )
          {
              throw new EnvironmentException( "NA", t );
          }
          finally
          {
              if( process != null )
              {
                  process.destroy();
                  exitValue = process.exitValue();
              }
              close( reader );
          }
          return exitValue;
      }
docs: Reads the environment variables and stores them in a Properties object.
  
  @param cmdExec    The command to execute to get hold of the environment variables.
  @param properties The Properties object to be populated with the environment variables.
  
  @return The exit value of the OS level process upon its termination.