jhat queries from command line
By kannan on Dec 15, 2007
There are several articles available on jhat and its usage
jhat typically requires to you to run the server from a console and launch a web browser to walk through the heap dumps and run various OQL queries. There maybe a lot of console (non-UI) based developers wanting to run queries or walk through the heap dump from command line and maybe redirect the various results to a file, thereby staying away from the browser. This could also be useful in cases where the heap dumps are quite huge and the browser UI takes a lot of time to load giving a "browser hang" impression to the user at times.
I have written one such tool that I currently call as JQuery and facilitates performing most of the operations from command line that you would normally do with mouse clicks on the browser
The tool covers most (if not all) of the common functionalities and infact interacts directly with jhat for every heap data output that you look for.
Note that the tool currently dumps output in html format and depending on the needs, I can make it dump output in text format for better readability.
How to run the tool:
- Preqrequisties: You need to have jhat server running on a heap dump obtained using jmap
- Compile and run the below JQuery class and connect to jhat server (see java JQuery -help for details)
- Once you are connected, -help <enter> should give you list of commands that you can use to walk through heap dumps and/or redirect the output to a file
Would appreciate any comments about the functionality/improvements of this tool.