시스템 환경 변수 출력 - 윈도우 커맨드창(cmd)에서 set 명령어 치는것과 유사
package com.zang;

import java.util.*;

public class GetProperties {
 public static void main(String args[]) {
  System.out.println("=======================================================");
  Map<String, String> envMap = System.getenv();
  Set evkey = envMap.keySet();
  Iterator evit = evkey.iterator();
  while(evit.hasNext()){
   String evcurKey = evit.next().toString();
   System.out.format("%s=%s\n",evcurKey, envMap.get(evcurKey));
  }
 }
}

출력화면

=======================================================
USERPROFILE=C:\Documents and Settings\장준혁
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_19
SystemDrive=C:
TEMP=C:\DOCUME~1\장준혁\LOCALS~1\Temp
ProgramFiles=C:\Program Files
Path=C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.6.0_19\bin;C:\Android\android-sdk\tools;C:\Program Files\IDM Computer Solutions\UltraEdit\
HOMEDRIVE=C:
PROCESSOR_REVISION=170a
CLIENTNAME=Console
USERDOMAIN=JUNHYUKJANG
ALLUSERSPROFILE=C:\Documents and Settings\All Users
PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 10, GenuineIntel
SESSIONNAME=Console
TMP=C:\DOCUME~1\장준혁\LOCALS~1\Temp
LOGONSERVER=\\JUNHYUKJANG
CommonProgramFiles=C:\Program Files\Common Files
PROCESSOR_ARCHITECTURE=x86
FP_NO_HOST_CHECK=NO
OS=Windows_NT
HOMEPATH=\Documents and Settings\장준혁
PROCESSOR_LEVEL=6
COMPUTERNAME=JUNHYUKJANG
windir=C:\WINDOWS
SystemRoot=C:\WINDOWS
NUMBER_OF_PROCESSORS=2
USERNAME=장준혁
ANDROID_HOME=C:\Android\android-sdk
ComSpec=C:\WINDOWS\system32\cmd.exe
APPDATA=C:\Documents and Settings\장준혁\Application Data

cmd set명령어 출력화면
신고
Posted by 까칠코더.


티스토리 툴바