Get all environment names and value in java

 

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class EnvDump {
    public static void main(String args[]) throws Exception {
        Set s = System.getProperties().entrySet();
        for (Iterator i = s.iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            System.out.println(entry.getKey() + " ======" +
                    entry.getValue());
        }

    }
}

相关帖子:
  • No Related Posts
  • micas Jun 13th 2005 09:56 pm JavaBasic No Comments yet Trackback URI Comments RSS

    Leave a Reply

    You must be logged in to post a comment.