Whether running Linux/Unix or Windows, all processes are run in an ENVIRONMENT. An ENVIRONMENT is a set of variables and values that affect how the operating system runs a process. By default, each command in a format's command array inherits its ENVIRONMENT from the servlet container, and the servlet container inherits its ENVIRONMENT from the user who owns the servlet container process.
You can run any command in a custom ENVIRONMENT:
On Linux/Unix, use the
env command.
Using the env command
gives you complete, explicit control of the ENVIRONMENT in which a
command is to be run. It is the recommended way to run a command in
a custom ENVIRONMENT. With the env
command, you can even use different ENVIRONMENTs within a single
command array, running individual commands each in a custom environment.
However, there is no counterpart for the
env command on Windows.
In the web.xml file, set the ATTEMPT_INHERIT_ENVIRONMENT <context-param> to "false" and create the variable-value pairs in the ENVIRONMENT <context-param>.
The web.xml file's ENVIRONMENT <context-param> is used to
explicitly set an entire ENVIRONMENT in which all commands in all
command arrays are run. Compared to using the
env command, this approach is
limited. But it
works in both Linux/Unix and Windows, and in Linux/Unix, you can override
it with the env command. Note that
if the ATTEMPT_INHERIT_ENVIRONMENT <context-param> is set to "true",
the value of the ENVIRONMENT <context-param> is ignored. For details
on using the ATTEMPT_INHERIT_ENVIRONMENT and the ENVIRONMENT
<context-param>s, see ATTEMPT_INHERIT_ENVIRONMENT and
ENVIRONMENT.
On Windows, to check the values contained in the ENVIRONMENT,
use cmd /C set as the third command
in the command array. On Linux/Unix, use the
env command with no arguments. The
output will be included with the usual server messages.