There are two ways to activate the Health Center agent when your Java™ application is started. There are additional considerations for specific WebSphere® or Rational® products.
Prerequisite
The Health Center agent must be installed. See Installing the Health Center agent for more information.
Procedure
java -agentlib:healthcenter -Xtrace:output=perfmon.out -classpath my/class/path.jar MyMainClass
java -Xhealthcenter -classpath my/class/path.jar MyMainClass
set IBM_JAVA_OPTIONS="-agentlib:healthcenter -Xtrace:output=perfmon.out"
set IBM_JAVA_OPTIONS="-Xhealthcenter"
05-Mar-2009 09:49:57 com.ibm.java.diagnostics.healthcenter.agent.mbean.HCLaunchMBean startAgent INFO: Health Center agent started on port 1972.
The port number is also written to the healthcenter.<pid>.log file in the users temporary directory. The <pid> is the process ID for the agent that is listening on that port.
To enable the Health Center agent when a JVM is started in a WebSphere or Rational product environment, see Configuring WebSphere or Rational product environments.
By default, the Health Center agent uses port 1972 for its communications. If it cannot use port 1972, it increments the port number and tries again, for up to 100 attempts. You can override the first port number that the agent tries to use.
java -Xhealthcenter:port=<port_number> HelloWorldOtherwise, use the com.ibm.java.diagnostics.healthcenter.agent.port command-line option. For example:
java -agentlib:healthcenter -Xtrace:output=perfmon.out -Dcom.ibm.java.diagnostics.healthcenter.agent.port=<port_number> HelloWorldTo change the port permanently, edit the following line in the healthcenter.properties file.
com.ibm.java.diagnostics.healthcenter.agent.portThis file is in the jre/lib directory of the JVM containing the agent.
com.ibm.java.diagnostics.healthcenter.data.collection.levelThis file is in the jre/lib directory of the JVM containing the agent.
For more information about troubleshooting problems with the Health Center agent, see Cannot connect to an application.