Wednesday, May 16, 2007

Useful JVM options for debugging.

To attach remote debugger to a stand alone java application, pass the following options to JVM.

${JAVA_HOME}/bin/java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=3345 JAVA_CLASS_NAME

* To make java process wait till debugger is attached, use suspend=y in the above options.

* To remote debug a war or ear application deployed in web or application container, set above options in web server or app server server.xml file.

* To provide more heap space to JVM, use options -Xms and -Xmx.