Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get static fields of a class in a heap dump in OQL

I have a heap dump and I'm using Eclipse MAT, though I suppose this should work through visualvm or whatever OQL client.

We can select fields of all instances of a class by doing something like

select s.field1, s.field2 from org.me.MyClass

... but this is restricted to member variables, and to types with instances.

How can select the static fields of a class with no instances?

This is somewhat related to this other question.

like image 704
Joe Kearney Avatar asked Oct 20 '10 09:10

Joe Kearney


1 Answers

To access static field 'props' of class java.lang.System you can use (in VisualVM)

select heap.findClass("java.lang.System").statics.props
select heap.findClass("java.lang.System").props
like image 96
Tomas Hurka Avatar answered Sep 22 '22 04:09

Tomas Hurka