Wednesday, January 13, 2016

Java System: Get Environment Map



  public static void getSystemEnvironmentMap() {
  Map envmap = System.getenv();
  Set> set = envmap.entrySet();
  Iterator> iterator = set.iterator();
  while (iterator.hasNext()) {

   Entry entry = iterator.next();
   System.out.println(entry.getKey());
   System.out.println(entry.getValue());
  }
 } 


This will return all environment variables




No comments:

Post a Comment