import java.util.*;
class JavaProps {
public static void main(String[] args) {
Properties p = System.getProperties();
p.setProperty("TestKey", "TestValue");
p.list(System.out);
}
}
COMPILE AND RUN
D:\TestWork\JavaCode>javac JavaProps.java
D:\TestWork\JavaCode>java -Draj=sonofking JavaProps
-- listing properties --
raj=sonofking
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\Program Files\Java\jre8\bin
java.vm.version=25.0-b70
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg=sun.io
user.script=
user.country=IN
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=Service Pack 1
java.vm.specification.name=Java Virtual Machine Specification
user.dir=D:\TestWork\JavaCode
java.runtime.version=1.8.0-b132
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files\Java\jre8\lib\endorsed
os.arch=amd64
java.io.tmpdir=C:\Users\KIRPAL~1.RAJ\AppData\Local\T...
line.separator=
java.vm.specification.vendor=Oracle Corporation
user.variant=
os.name=Windows 7
sun.jnu.encoding=Cp1252
java.library.path=C:\windows\system32;C:\windows\Sun\Ja...
java.specification.name=Java Platform API Specification
java.class.version=52.0
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
os.version=6.1
user.home=C:\Users\kirpalsinh.raj
TestKey=TestValue
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.specification.version=1.8
file.encoding=Cp1252
user.name=kirpalsinh.raj
java.class.path=.
java.vm.specification.version=1.8
sun.arch.data.model=64
java.home=C:\Program Files\Java\jre8
sun.java.command=JavaProps
java.specification.vendor=Oracle Corporation
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.8.0
java.ext.dirs=C:\Program Files\Java\jre8\lib\ext;C:...
sun.boot.class.path=C:\Program Files\Java\jre8\lib\resour...
sun.stderr.encoding=cp437
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.stdout.encoding=cp437
sun.desktop=windows
sun.cpu.isalist=amd64
class JavaProps {
public static void main(String[] args) {
Properties p = System.getProperties();
p.setProperty("TestKey", "TestValue");
p.list(System.out);
}
}
COMPILE AND RUN
D:\TestWork\JavaCode>javac JavaProps.java
D:\TestWork\JavaCode>java -Draj=sonofking JavaProps
-- listing properties --
raj=sonofking
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\Program Files\Java\jre8\bin
java.vm.version=25.0-b70
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg=sun.io
user.script=
user.country=IN
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=Service Pack 1
java.vm.specification.name=Java Virtual Machine Specification
user.dir=D:\TestWork\JavaCode
java.runtime.version=1.8.0-b132
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files\Java\jre8\lib\endorsed
os.arch=amd64
java.io.tmpdir=C:\Users\KIRPAL~1.RAJ\AppData\Local\T...
line.separator=
java.vm.specification.vendor=Oracle Corporation
user.variant=
os.name=Windows 7
sun.jnu.encoding=Cp1252
java.library.path=C:\windows\system32;C:\windows\Sun\Ja...
java.specification.name=Java Platform API Specification
java.class.version=52.0
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
os.version=6.1
user.home=C:\Users\kirpalsinh.raj
TestKey=TestValue
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.specification.version=1.8
file.encoding=Cp1252
user.name=kirpalsinh.raj
java.class.path=.
java.vm.specification.version=1.8
sun.arch.data.model=64
java.home=C:\Program Files\Java\jre8
sun.java.command=JavaProps
java.specification.vendor=Oracle Corporation
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.8.0
java.ext.dirs=C:\Program Files\Java\jre8\lib\ext;C:...
sun.boot.class.path=C:\Program Files\Java\jre8\lib\resour...
sun.stderr.encoding=cp437
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.stdout.encoding=cp437
sun.desktop=windows
sun.cpu.isalist=amd64
No comments:
Post a Comment