Strarting jmx agent

Sun and IBM Java SDK and JRE version 1.5 or higher already have embedded jmx-rmi agent server. To activate it add following properties before jvm started:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=jmxPort
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
where jmxPort is free tcp port.

Start JMX agent of systems which have own startup scripts.

Many systems has complex startup scripts. Another problem can be that application register their mbean in several mbean servers. Below is actions then should be done for managing specific applications.

Tomcat: add following lines in the beginning of startup.bat file:
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=jmxPort
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.ssl=false

Jetty: modify etc/jetty-jmx.xml config file for old server version:
Change name attribute of call element from createMBeanServer to getPlatformMBeanServer
And start the server like this:
java -Dcom.sun.management.jmxremote.port=jmxPort -jar start.jar etc/jetty-jmx.xml etc/jetty.xml

JBoss: add following lines in the beginning of run.bat file:
set JAVA_OPTS=%JAVA_OPTS% -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl
set JAVA_OPTS=%JAVA_OPTS% -Djboss.platform.mbeanserver
Verify that com.sun.management.jmxremote* properties not set.

Geronimo: add following lines in the beginning of geronimo.bat file:
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
And use port=1099, user=system, password=manager to connect to server.

JOnAS: add following lines to jonas.bat:
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
Use port=1099 to connect to server.

OC4J: add following lines in the beginning of oc4j.cmd:
set OC4J_JVM_ARGS=%OC4J_JVM_ARGS% -Dcom.sun.management.jmxremote
set OC4J_JVM_ARGS=%OC4J_JVM_ARGS% -Dcom.sun.management.jmxremote.port=jmxPort
set OC4J_JVM_ARGS=%OC4J_JVM_ARGS% -Dcom.sun.management.jmxremote.authenticate=false
set OC4J_JVM_ARGS=%OC4J_JVM_ARGS% -Dcom.sun.management.jmxremote.ssl=false

Resin: start the server like this:
httpd.exe -Dcom.sun.management.jmxremote.port=jmxPort

If your monitored application is web server, then following RunJMXServerContextListener context listener to web.xml. This listener start jmx agent on 6048 port.

Eclipse: add to the end of eclipse.ini file properties:
-Dcom.sun.management.jmxremote.port=jmxPort
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

IntelliJ IDEA: add to bin/idea.exe.vmoptions file:
-Dcom.sun.management.jmxremote.port=jmxPort
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Oracle SQL developer: add to sqldeveloper/bin/sqldeveloper.conf file:
AddVMOption -Dcom.sun.management.jmxremote.port=jmxPort
AddVMOption -Dcom.sun.management.jmxremote.authenticate=false
AddVMOption -Dcom.sun.management.jmxremote.ssl=false

NetBeans: add to netbeans_default_options property of etc/netbeans.conf file properties without line breaks:
-J-Dcom.sun.management.jmxremote.port=jmxPort
-J-Dcom.sun.management.jmxremote.authenticate=false
-J-Dcom.sun.management.jmxremote.ssl=false

From java code:
Following method creatJMXConnectorAndRMIRegistry start jmx-rmi agent.

Additional resources about JMX available at:
http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#gdenl
http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html