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 = iterator.next().toString();
            String value = map.get(key).toString();

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

        }
    }
}

Comments

Popular posts from this blog

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

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

Getting Umbraco Content - IPublishedContent vs IContent vs Node vs Document