This section provides a tutorial example on how to list all properties from the JVM and the OS that are accessible by your Java application.
Java application programs are executed inside a Java Virtual Machine (JVM),
which is in turn executed inside an Operating System (OS).
From the Java application program point of view,
the JVM, together with the OS, represents the computer system. The properties of
the JVM and the OS are all called system properties.
A Java application program can:
Use System.getProperty(String propertyName) to get the value of a specific system
property.
Use System.getProperties() to get all available system properties.
Here is an example program that displays the values of all available system properties:
/**
* SysProperties.java
* Copyright (c) 2002 by Dr. Herong Yang
*/
import java.util.*;
public class SysProperties {
public static void main(String[] a) {
Properties sysProps = System.getProperties();
sysProps.list(System.out);
}
}