import java.util.Properties;
import java.io.*;

public class Win2KSysProps {

    public static void main (String[] args) {
	Properties props = System.getProperties();
	System.out.println("=======Displaying Java System Properties=======");
	props.list(System.out);
	Runtime rt = Runtime.getRuntime();
	try {
	    // Start a new shell and run the "set" command to display
	    // environment variables.
	    Process proc = rt.exec("C:\\WINNT\\system32\\cmd.exe /c set");
	    BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
	    String output = in.readLine();
	    System.out.println("========Displaying Shell Variables========");
	    while (output != null) {
		System.out.println(output);
		output = in.readLine();
	    }
	    proc.waitFor();
	} catch (Exception e) {
	    System.out.println("Exception: " + e);
	}
    }
    
}
