Java – Show System Properties

You can use Properties to configure your java application. The Java platform itself uses System Properties to maintain its own configuration. With the java.lang.System class you can access the Properties object that describes the configuration of the java environment. In System Properties you can find information about the current user, the current version of the Java runtime, the CPU and the character used to separate components of a file path name. To list all System Properties you can use the following snippet.


Iterator iterator = System.getProperties().keySet().iterator();
while (iterator.hasNext())
{
String key = (String)iterator.next();
String value = System.getProperties().getProperty(key);
System.out.println (key + " " + value);
}

On my machine the result looks like this:

java.vm.specification.vendor Oracle Corporation
user.variant
os.name Windows 10
sun.jnu.encoding Cp1252
java.library.path C:\Tools\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Users\jentsch\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\jentsch\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\app\oracle\product\11203\client64\bin;C:\app\oracle\product\11203\client32\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Program Files\PuTTY;C:\Android;C:\Windows\System32;C:\Program Files\TortoiseGit\bin;C:\Users\jentsch\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\nodejs;C:\Program Files\TortoiseSVN\bin;C:\Users\jentsch\AppData\Local\Microsoft\WindowsApps;C:\Program Files\apache-maven-3.2.5\bin;C:\Program Files\Java\jdk1.8.0_141\bin;C:\Program Files\Microsoft VS Code\bin;C:\Toolsl\Gource\cmd;C:\Tools\ffmpeg-3.4.1-win64-static\bin;C:\Users\jentsch\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl;.
java.specification.name Java Platform API Specification
java.class.version 52.0
sun.management.compiler HotSpot 64-Bit Tiered Compilers
os.version 10.0
user.home C:\Users\jentsch
user.timezone Europe/Berlin
java.awt.printerjob sun.awt.windows.WPrinterJob
file.encoding Cp1252
java.specification.version 1.8
java.class.path drivers\derby-10.14.2.0.jar;drivers\derbyclient-10.14.2.0.jar;drivers\h2-1.4.197.jar;drivers\hsqldb-2.4.0.jar;drivers\jtds-1.3.1.jar;drivers\mariadb-java-client-2.2.4.jar;drivers\mssql-jdbc-6.4.0.jre7.jar;drivers\postgresql-42.2.2.jre6.jar;drivers\sqlite-jdbc-3.20.1.jar
user.name jentsch
java.vm.specification.version 1.8
sun.java.command org.test.commandline.Main migrate
java.home C:\Tools\jre
sun.arch.data.model 64
user.language en
java.specification.vendor Oracle Corporation
user.language.format de
awt.toolkit sun.awt.windows.WToolkit
java.vm.info mixed mode
java.version 1.8.0_172
java.ext.dirs C:\Tools\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
sun.boot.class.path C:\Tools\jre\lib\resources.jar;C:\Tools\jre\lib\rt.jar;C:\Tools\jre\lib\sunrsasign.jar;C:\Tools\jre\lib\jsse.jar;C:\Tools\jre\lib\jce.jar;C:\Tools\jre\lib\charsets.jar;C:\Tools\jre\lib\jfr.jar;C:\Tools\jre\classes
java.vendor Oracle Corporation
file.separator \
java.vendor.url.bug http://bugreport.sun.com/bugreport/
sun.io.unicode.encoding UnicodeLittle
sun.cpu.endian little
sun.desktop windows
sun.cpu.isalist amd64


This code snippet have been written for JDK 8. Examples and practices described in this page don’t take advantage of improvements introduced in later releases.