Retrieve environment variables (JDK1.5)
import java.util.Iterator; import java.util.Map; public class Main { public static void main(String args[]) { System.out.println("PATH = " + System.getenv("PATH")); 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()); } } }