com.sun.javatest.util
public class SysEnv extends java.lang.Object
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 and Description |
---|
SysEnv() |
Modifier and Type | Method and Description |
---|---|
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.
|
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 variablepublic 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.Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.