Knowledge Walls
John Peter
Pune, Maharashtra, India
How to get system information in java? in Computer software engineer articles of One day One Thing to Know
15342 Views
System.getProperties() to get all information about system or hardware in JAVA.

   1. Java version
   2. OS name
   3. Java and Jre location
   and More

Example in JAVA
import java.lang.*;

public class Example{
    public static void main(String args[]) throws Exception {       
        for (Object propertyKeyName:System.getProperties().keySet()){
            System.out.println(propertyKeyName+" - "+System.getProperty(propertyKeyName.toString()));
        }
    }
}
Output 
java.runtime.name - Java(TM) SE Runtime Environment
sun.boot.library.path - D:\java\jre6\bin
java.vm.version - 16.0-b13
java.vm.vendor - Sun Microsystems Inc.
java.vendor.url - http://java.sun.com/
path.separator - ;
java.vm.name - Java HotSpot(TM) Client VM
file.encoding.pkg - sun.io
sun.java.launcher - SUN_STANDARD
user.country - US
sun.os.patch.level -
java.vm.specification.name - Java Virtual Machine Specification
java.runtime.version - 1.6.0_18-b07
java.awt.graphicsenv - sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs - D:\java\jre6\lib\endorsed
os.arch - x86
java.io.tmpdir - C:\Users\SmartPC\AppData\Local\Temp\
line.separator -
java.vm.specification.vendor - Sun Microsystems Inc.
user.variant -
os.name - Windows 7
sun.jnu.encoding - Cp1252
java.specification.name - Java Platform API Specification
java.class.version - 50.0
sun.management.compiler - HotSpot Client Compiler
os.version - 6.1
user.home - C:\Users\SmartPC
user.timezone -
java.awt.printerjob - sun.awt.windows.WPrinterJob
file.encoding - Cp1252
java.specification.version - 1.6
java.class.path - D:\java\build\classes;
                C:\apache-tomcat-7.0.14\lib\tomcat-i18n-ja.jar;
                C:\apache-tomcat-7.0.14\lib\tomcat-util.jar
user.name - SmartPC
java.vm.specification.version - 1.0
java.home - D:\java\jre6
sun.arch.data.model - 32
user.language - en
java.specification.vendor - Sun Microsystems Inc.
awt.toolkit - sun.awt.windows.WToolkit
java.vm.info - mixed mode
java.version - 1.6.0_18
java.ext.dirs - D:\java\jre6\lib\ext;C:\Windows\Sun\Java\lib\ext
sun.boot.class.path - D:\java\jre6\lib\resources.jar;
                    D:\java\jre6\lib\rt.jar;
                    D:\java\jre6\lib\sunrsasign.jar;
                    D:\java\jre6\lib\jsse.jar;
                    D:\java\jre6\lib\jce.jar;
                    D:\java\jre6\lib\charsets.jar;
                    D:\java\jre6\classes
java.vendor - Sun Microsystems Inc.
file.separator - \
java.vendor.url.bug - http://java.sun.com/cgi-bin/bugreport.cgi
sun.io.unicode.encoding - UnicodeLittle
sun.cpu.endian - little
sun.desktop - windows
sun.cpu.isalist - pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86

Next Topics
Next lessons of current book.
Computer software engineer articles of One day One Thing to Know
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details