Wednesday 27 August 2014

List All System Properties in Java

getProperties() method of System class return all the system properties.

import java.util.Properties;

public class ListProperties {
    public static void main(String args[]){
        Properties props = System.getProperties();
        props.list(System.out);
    }
}

Output
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\Program Files (x86)\Java\jdk1.8.0_...
java.vm.version=25.5-b02
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.script=
user.country=US
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=Service Pack 1
java.vm.specification.name=Java Virtual Machine Specification
user.dir=C:\Users\Documents\NetBeans...
file.encoding.pkg=sun.iojava.runtime.version=1.8.0_05-b13
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files (x86)\Java\jdk1.8.0_...
os.arch=x86
java.io.tmpdir=C:\Users\AppData\Local\Temp\
line.separator=

java.vm.specification.vendor=Oracle Corporation
user.variant=
os.name=Windows 7
sun.jnu.encoding=Cp1252
java.library.path=C:\Program Files (x86)\Java\jdk1.8.0_...
java.specification.name=Java Platform API Specification
java.class.version=52.0
sun.management.compiler=HotSpot Client Compiler
os.version=6.1
user.home=C:\Users
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=UTF-8
java.specification.version=1.8
user.name=harikrishna
java.class.path=C:\Users\Documents\NetBeans...
java.vm.specification.version=1.8
sun.arch.data.model=32
java.home=C:\Program Files (x86)\Java\jdk1.8.0_...
sun.java.command=ListProperties
java.specification.vendor=Oracle Corporation
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.8.0_05
java.ext.dirs=C:\Program Files (x86)\Java\jdk1.8.0_...
sun.boot.class.path=C:\Program Files (x86)\NetBeans 8.0\e...
java.vendor=Oracle Corporation
file.separator=\
java.vendor.url.bug=http://bugreport.sun.com/bugreport/
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.desktop=windows
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+m...




                                                             Home

No comments:

Post a Comment