About using environment settings
Each tool has a set of parameters used to execute an operation. Some of these parameters are common among all tools, such as a tolerance or output location. These parameters can obtain default values from a geoprocessing environment that all tools utilize during operation. When a tool is executed, the current environment settings can be used as global input parameter values. Settings, such as an area of interest, the coordinate system of the output dataset, and the cell size of a new raster dataset, can be specified in the geoprocessing environments.
The following code example shows retrieving environment values, setting environment values, and resetting environment values:
[Java]
// Get the cell size environment value.
gp.setEnvironmentValue("cellsize", Double.valueOf(10.0));
String env = (String)gp.getEnvironmentValue("cellsize");
// Set the output coordinate system environment.
gp.setEnvironmentValue("outputCoordinateSystem",
"c:/Program Files/ArcGIS/Coordinate Systems/Projected Coordinate Systems/UTM/Nad 1983/NAD 1983 UTM Zone 21N.prj");
// Reset the default environment values.
gp.resetEnvironments();