Retrieve environment variables (JDK1.5)Tag(s): Environment
JDK1.5
System.getenv() is back!
import java.util.*;
public class Test {
  public static void main(String args[]) {
    // just one
    System.out.println("PATH = " + System.getenv("PATH"));
    // all of them
    Map env = System.getenv();
    for (Iterator it=env.entrySet().iterator(); it.hasNext(); ) {
       Map.Entry entry = (Map.Entry)it.next();
       System.out.println(entry.getKey() + " = " + entry.getValue());
    }
  }
}
See also this HowTo.
See this Howto for common XP environment variables
  mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com
