sandip chitale's blog    Sandip Chitale's blog (scblog)
NOTE: I have moved many of my modules to NetBeans Plugin Portal . Please check there for latest versions of modules described on this blog.
20061003 Tuesday October 03, 2006

Swing based JHAT OQL execution application In the last blog I talked about using the cool Java 6 JDK tools such as:

  • jps JVM Process Status Tool - Lists instrumented HotSpot Java virtual machines on a target system.
  • jmap Memory Map for Java - Prints shared object memory maps or heap memory details of a given process or core file or a remote debug server.
  • jhat Heap Dump Browser - Starts a web server on a heap dump file (eg, produced by jmap -dump), allowing the heap to be browsed.

to explore the Netbeans runtime.

I put together a Swing based JHAT OQL execution app. It can execute JHAT's OQL queries. It is not fully complete in terms of displaying full info about classes and objects but mostly works.

To learn more about OQL queries see A. Sundararajan's blog .

Download

 The SwingJHAT.jar is the SwingJHAT application jar.

How to run?

> java -Xmx256m -Xbootclasspath/a:"\Program Files\Java\jdk1.6.0\lib\tools.jar" -jar SwingJHAT.jar

Required JDK version

> java -version
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)


Screenshot

Here is a screen shot of the results of same query (Netbeans module dependency report) I talked about in the last blog:



To try

  • Create a heap dump file as described in the last blog.
  • Select the heap dump (format=b) by clicking on the Select... button in SwingJHAT window.
  • Now you can directly enter an OQL query in Executed Query text area. Alternatively you can enter an OQL query in the Structured Query form on the left. Here are some sample queries:

select classof(cl).name from instanceof java.lang.ClassLoader cl

select file.path.value.toString() from java.io.File file

  • Click on the Execute button to run the OQL query.

In case anyone wants to hack the code SwingJHAT.zip contains the Netbeans (6.0Dev) project. To build the project you will need to define a library named JDK6TOOLS pointing to:

\Program Files\Java\jdk1.6.0\lib\tools.jar

using the Tools:Library Manager.

TODO

  • Full display of objects (referrers, fields etc) and classes (subclasses etc)
  • Buit-in queries
  • Forward and Backward history in the Results window
  • May be a java.net project
DISCLAIMER: This is an experimental application. So no guarantees. Use the application at your own risk.

Posted by sandipchitale ( Oct 03 2006, 10:28:18 AM PDT ) Permalink Comments [4]










« October 2006 »
SunMonTueWedThuFriSat
1
2
4
6
7
8
10
11
12
13
15
17
18
20
21
22
23
24
25
26
27
28
30
31
    
       
Today

Get NetBeans 5.5

Locations of visitors to this page

Today's Page Hits: 134


XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

scblog
scblog