blob: 55133dfb01f23535d2359ff59d6c4b3713f2ae60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import java.util.Map;
import java.util.TreeSet;
public class GetEnv {
/**
* let's test generics
* @param args the command line arguments
*/
public static void main(String[] args) {
// get a map of environment variables
Map<String, String> env = System.getenv();
// build a sorted set out of the keys and iterate
for(String k: new TreeSet<String>(env.keySet())) {
System.out.printf("%s = %s\n", k, env.get(k));
}
} }
|