Click here to watch in Youtube :
https://www.youtube.com/watch?v=uxBVYUluWb4&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial: Properties class in java [How to get all the system properties] |
Java Tutorial: Properties class in java [How to get all the system properties] |
import java.io.IOException; import java.util.Iterator; import java.util.Properties; import java.util.Set; class PropertiesDemo { public static void main(String[] args) throws IOException { /* * Returns the system properties */ Properties p = System.getProperties(); /* * Returns a set of keys in this property list where * the key and its corresponding value are strings, * including distinct keys in the default property * list if a key of the same name has not already * been found from the main properties list. */ Set<String> set = p.stringPropertyNames(); Iterator<String> itr = set.iterator(); while (itr.hasNext()) { String key = (String) itr.next(); /* * Gets the system property indicated by the * specified key. */ String value = p.getProperty(key); System.out.println(key + " = " + value); } } }Output
java.runtime.name = Java(TM) SE Runtime Environment sun.boot.library.path = C:\Java\jre1.8.0_111\bin java.vm.version = 25.111-b14 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 = US sun.java.launcher = SUN_STANDARD sun.os.patch.level = Service Pack 1 java.vm.specification.name = Java Virtual Machine Specification user.dir = D:\eclipse\workspace\PropertiesDemo java.runtime.version = 1.8.0_111-b14 java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment java.endorsed.dirs = C:\Java\jre1.8.0_111\lib\endorsed os.arch = amd64 java.io.tmpdir = C:\Users\Ramesh\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:\Java\jre1.8.0_111\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Java/jre1.8.0_111/bin/server;C:/Java/jre1.8.0_111/bin;C:/Java/jre1.8.0_111/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;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\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;C:\Program Files\OpenVPN\bin;C:\Java\jdk1.8.0_111\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\Program Files\TortoiseHg\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\eclipse;;. 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\Ramesh user.timezone = java.awt.printerjob = sun.awt.windows.WPrinterJob file.encoding = Cp1252 java.specification.version = 1.8 user.name = Ramesh java.class.path = D:\eclipse\workspace\PropertiesDemo\bin java.vm.specification.version = 1.8 sun.arch.data.model = 64 java.home = C:\Java\jre1.8.0_111 sun.java.command = PropertiesDemo java.specification.vendor = Oracle Corporation user.language = en awt.toolkit = sun.awt.windows.WToolkit java.vm.info = mixed mode java.version = 1.8.0_111 java.ext.dirs = C:\Java\jre1.8.0_111\lib\ext;C:\Windows\Sun\Java\lib\ext sun.boot.class.path = C:\Java\jre1.8.0_111\lib\resources.jar;C:\Java\jre1.8.0_111\lib\rt.jar;C:\Java\jre1.8.0_111\lib\sunrsasign.jar;C:\Java\jre1.8.0_111\lib\jsse.jar;C:\Java\jre1.8.0_111\lib\jce.jar;C:\Java\jre1.8.0_111\lib\charsets.jar;C:\Java\jre1.8.0_111\lib\jfr.jar;C:\Java\jre1.8.0_111\classes 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 = amd64Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/PropertiesDemo_System_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/PropertiesDemo_System_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/fecc858ed896ce9bbf3cb92f5d438fc2de9eee22/BasicJava/PropertiesDemo_System_App/?at=master
See also:
No comments:
Post a Comment