|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.javatest.util.SysEnv
public class SysEnv
A class to provide access to OS environment variables, by means of an external command which is executed. The command will be executed when the first access is made to the environment variables. The command name is determined as follows:
OS | Default |
---|---|
Mac OS X | /usr/bin/env |
Solaris | /usr/bin/env |
Windows XP | cmd /c set |
Note that the specified command will be invoked by Runtime.exec and must be capable or working as such. This may preclude direct use of builtin commands on some systems. For example, you cannot directly exec the Windows "set" command built in to the standard Windows command shell.
The command must print out a series of lines of the form name=value, one for each environment variable.
Constructor Summary | |
---|---|
SysEnv()
|
Method Summary | |
---|---|
static java.lang.String |
get(java.lang.String name)
Get the value of a specified environment value. |
static java.util.Map |
getAll()
Get a map containing all of the environment variables in the current execution context. |
static java.util.Map |
getAll(java.util.Map m)
Get a map containing all of the environment variables in the current execution context. |
static void |
setCommand(java.lang.String cmd)
Set the command to be executed to access the OS environment variables. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SysEnv()
Method Detail |
---|
public static void setCommand(java.lang.String cmd)
cmd
- the command to be executedpublic static java.lang.String get(java.lang.String name)
name
- the name of the environment variable
public static java.util.Map getAll()
public static java.util.Map getAll(java.util.Map m)
m
- the map in which to put the names and values of all the
environment variables in the current execution context.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |