import java.util.Properties;
import java.io.*;

public class UnixSysProps {

    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 {
	    // Run the "set" command to display environment variables.
	    // Behavior depends on the default shell.  We could use the
	    // string "/bin/sh -c set" to force the /bin/sh shell instead.
	    Process proc = rt.exec("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);
	}
    }
    
}
