tags:

views:

1231

answers:

3

The log file from a JVM crash contains all sorts of useful information for debugging, such as shared libraries loaded and the complete environment. Can I force the JVM to generate one of these programmatically; either by executing code that crashes it or some other way? Or alternatively access the same information another way?

A: 

I am pretty sure this can be done with the IBM JDK as I was playing around with their stack analyzer some time ago. One option to force the dump would just to cause an outOfMemoryException.

These tools may provide some clues http://www.ibm.com/developerworks/java/library/j-ibmtools1/

The link seems to be about a tool available only to IBM customers, of which I am not one.
DJClayworth
+1  A: 

Have a look at the JDK Development Tools, in particular the Troubleshooting Tools for dumping the heap, printing config info, etcetera.

McDowell
+1  A: 

You can try throwing an OutOfMemoryError and adding the -XX:+HeapDumpOnOutOfMemoryError jvm argument. This is new as of 1.6 as are the other tools suggested by McDowell. http://blogs.sun.com/watt/resource/jvm-options-list.html

ghbuch