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
Java Book
Essential Classes
System:
- System class
- Standard Stream
- Copy array
- Get/set system property
- Get the system environment
- Current system time