Get the system environment

static Map<String,String> getenv()
Returns an unmodifiable string map view of the current system environment.

public class Main {

  public static void main(String args[]) {
    System.out.println(System.getenv());

  }
}

The output:


{USERPROFILE=C:\Documents and Settings\abc, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH, ANT_OPTS=-
Xmx1024m, JAVA_HOME=C:\Java_Dev\sdk\jdk, TEMP=C:\DOCUME~1\abc\LOCALS~1\Temp, SystemDrive=C:, ProgramFiles=C:\Program 
...
...
...
...
...
...


ComSpec=C:\WINDOWS\system32\cmd.exe, APPDATA=C:\Documents and Settings\abc\Application Data}
Home 
  Java Book 
    Essential Classes  

System:
  1. System class
  2. Standard Stream
  3. Copy array
  4. Get/set system property
  5. Get the system environment
  6. Current system time