Obtener las variables de entorno desde Java

Thursday, March 22, 2012 20:40
Posted in category Programación
import java.util.Map;
import java.util.Set;
import java.util.Iterator;
 
public class EnvironmentInformation{
  public static void main(String[] args){
  Map map = System.getenv();
  Set keys = map.keySet();
  Iterator iterator = keys.iterator();
  System.out.println("Nombre de la variable \t Valor de la Variable");
  while (iterator.hasNext()){
  String key = (String) iterator.next();
  String value = (String) map.get(key);
  System.out.println(key + " " + value);
  }
  }
}
You can leave a response, or trackback from your own site.

Leave a Reply