code: private static void printEnvVariables() {
      System.out.println("Environment Variables: ");
      Map<String,String> map = System.getenv();
      Set<String> keys = map.keySet();
      Iterator iter = keys.iterator();
      while(iter.hasNext()) {
        String thiskey = (String)(iter.next()); 
        String value = map.get(thiskey);
        System.out.println(thiskey + " = " + value);
      }
    }
docs: prints all environment variables for this process