Advertisement
JeffGrigg

SystemPropertiesAndEnvironmentVariables

Jul 1st, 2018
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.89 KB | None | 0 0
  1. import java.util.Map;
  2. import java.util.Properties;
  3.  
  4. public class SystemPropertiesAndEnvironmentVariables {
  5.     public static void main(String[] args) {
  6.  
  7.         System.out.println("-----------------------------------------------------------------------------------------");
  8.         System.out.println("System Properties:");
  9.         final Properties properties = System.getProperties();
  10.         properties.list(System.out);
  11.  
  12.         System.out.println("-----------------------------------------------------------------------------------------");
  13.         System.out.println("System Environment Variables:");
  14.         for (final Map.Entry envEnt : System.getenv().entrySet()) {
  15.             System.out.println(envEnt.getKey() + " = " + envEnt.getValue());
  16.         }
  17.  
  18.         System.out.println("-----------------------------------------------------------------------------------------");
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement