Skip to main content

Posts

Showing posts with the label Environment Variables

Java System Properties

This is a quick post with some useful code for printing a complete list of Java system properties. System properties give you access to certain JVM startup parameters and system information. The following code (SysProp.java) can be used to print all system properties. import java.util.Properties; import java.util.Enumeration; public class SysProp { public static void main(String[] args) { Properties sysprops = System .getProperties(); Enumeration e = sysprops.propertyNames(); while (e.hasMoreElements()) { String key = (String)e.nextElement(); String value = sysprops.getProperty(key); System.out.println(key + "=" + value); } } } The resulting output should look like this: java.vm.vendor.url.bug=http://edocs.bea.com/jrockit/go2troubleshooting.html java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition sun.boot.library.path=E:\APPS\bea_x64\jrockit-R27.5.0-jdk1.5.0_14\jre\bin java.vm.version=R27.5.0-110_o-99226-1.5.0_14-20080528-1505-windows-x86_64 ...