Searching...
Wednesday, 6 November 2013

How to get System Environment details in java?

09:10

Example

package com.pretech;
import java.util.Map;
import java.util.Map.Entry;
public class SystemEnvExample {
	public static void main(String[] args) {
		Map<String, String> hMap = System.getenv();
        for (Entry<String, String> entry : hMap.entrySet()) {
            System.out.println(entry.getKey() + "  = "
                         + entry.getValue());
     }
	}
}

Output



USERPROFILE  = C:\Users\vinod
ProgramData  = C:\ProgramData
PATHEXT  = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
JAVA_HOME  = C:\Program Files\Java\jdk1.7.0_06\
ProgramFiles(x86)  = C:\Program Files (x86)
TEMP  = C:\Users\vinod\AppData\Local\Temp
SystemDrive  = C:
MOZ_PLUGIN_PATH  = C:\Program Files (x86)\Foxit Software\Foxit Reader\plugins\
ProgramFiles  = C:\Program Files
Path  = C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Broadcom\Broadcom 802.11\Driver;C:\Program Files\Java\jdk1.7.0_06\bin;D:\bOnPC_Development\apache-maven-3.0.1\bin;C:\Program Files\Internet Explorer;
HOMEDRIVE  = C:
PROCESSOR_REVISION  = 2505
USERDOMAIN  = vinod-PC
ALLUSERSPROFILE  = C:\ProgramData
ProgramW6432  = C:\Program Files
PROCESSOR_IDENTIFIER  = Intel64 Family 6 Model 37 Stepping 5, GenuineIntel
SESSIONNAME  = Console
TMP  = C:\Users\vinod\AppData\Local\Temp
CommonProgramFiles  = C:\Program Files\Common Files
=::  = ::\
LOGONSERVER  = \\VINOD-PC
PROCESSOR_ARCHITECTURE  = AMD64
FP_NO_HOST_CHECK  = NO
OS  = Windows_NT
HOMEPATH  = \Users\vinod
PROCESSOR_LEVEL  = 6
CommonProgramW6432  = C:\Program Files\Common Files
classpath  = C:\Program Files\Java\jdk1.7.0_06\lib;
LOCALAPPDATA  = C:\Users\vinod\AppData\Local
COMPUTERNAME  = VINOD-PC
windir  = C:\Windows
SystemRoot  = C:\Windows
NUMBER_OF_PROCESSORS  = 4
USERNAME  = vinod
PUBLIC  = C:\Users\Public
PSModulePath  = C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
CommonProgramFiles(x86)  = C:\Program Files (x86)\Common Files
ComSpec  = C:\Windows\system32\cmd.exe
APPDATA  = C:\Users\vinod\AppData\Roaming


0 comments: