import java.util.Properties; public class SystemProperties { public static void main(String[] args) { Properties properties = System.getProperties(); properties.list(System.out); } }
public class SystemProperty { public static void main(String[] args) { String propertyValue = System.getProperty("java.home"); System.out.println("Java Home: " + propertyValue); } }This example uses the getProperty() method to access a specific system property (in this case, the location of the Java home directory). Package Library: java.lang