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:
- Open the administrative console.
- Select Servers > Application Server, then click on
the desired Application Server.
- Under Additional Properties click Process Definition.
- Click Java Virtual Machine, then under Additional
Properties click Custom Properties.
- Type a Name Value pair for the desired variable.
- Save and synchronize the configuration.
- 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) |