Getting the environmental variables on Windows

Here is an example for getting the environmental variables on a Windows machine. 

package environmentalvariables;

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

 * @author nurhak.kaya
public class EnvironmentalVariables {

    public static void main(String[] args) {

        Map map = System.getenv();
        Set keys = map.keySet();
        Iterator iterator = keys.iterator();

        while (iterator.hasNext()) {

            String key =;
            String value = map.get(key).toString();

            System.out.println(key + " --> " + value);



Popular posts from this blog

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"

Solution for "Can not obtain Oracle client information from registry"