When a Java Application initiates, by default it is loaded with some environment variables and system properties it can use. Using these environment variables and system properties ensures 100% platform independence. Following is a program which lists all the environment variables and system properties a Java Application can use.
EnvironmentVariables.java
import java.util.*;
/**
* @author Shazin Sadakath
*
**/
public class EnvironmentVariables{
public static void main(String[] args){
Map env = System.getenv();
Collection
System.out.println(”– Environment Variables –\n”);
for(String s:col){
System.out.println(s + “=” + env.get(s));
}
System.out.println();
Properties props = System.getProperties();
props.list(System.out);
}
}
No comments:
Post a Comment