How to set an environment variable to use within an application running on WebSphere Application Server V5 and V5.1
 Technote (troubleshooting)
 
Problem(Abstract)
Within the IBM® WebSphere® Application Server environment there might be a need to set a name/value pair and access for an application.
 
Cause
How to set this is unclear because there are WebSphere Application Server variables and JVM™ properties.
 
Resolving the problem
You can access variables in the WebSphere Application Server administrative console by selecting Environment > Manage WebSphere Variables.

These name/value pairs are used to represent variables used in the WebSphere Application Server configuration files. They are not intended for use within an application running in the Application Server. You can access the variables using internal tools such as wsadmin, but this is not an easy solution.

The best solution is to pass a system property to the JVM™ that can easily be accessed within an application running in the Application Server.

To do this:

  1. Open the administrative console.

  2. Select Servers > Application Server, then click on the desired Application Server.

  3. Under Additional Properties click Process Definition.

  4. Click Java Virtual Machine, then under Additional Properties click Custom Properties.

  5. Type a Name Value pair for the desired variable.

  6. Save and synchronize the configuration.

  7. Recycle the Application Server to have the JVM pick up the System Property.

Access this new property with the System.getProperty code within your Application.
Example: System.getProperty("my_variable");

Additional Information on WebSphere Variables is in the following technote:
Modifying Environment Variables in V5.0 (all releases)
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Java SDK
Operating system(s): Windows
Software version: 5.1.1
Software edition:
Reference #: 1171516
IBM Group: Software Group
Modified date: Aug 16, 2004