Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug JVM resources loading?

To debug class loading in a JVM we can use the param -verbose:class, but... Anyone knows how to debug resources loading (e.g. properties files)?

like image 725
aows Avatar asked Apr 15 '09 08:04

aows


People also ask

How do I debug JVM?

Enable JVM DebuggingClick Java > JVM Settings tab. Under Debug Java Settings, select the Enable Debug checkbox. Provide JVM options as necessary by clicking the New button. If you substitute suspend=y, the JVM starts in suspended mode and stays suspended until a debugger attaches to it.

How does JVM debugging work?

Since in the JVM architecture, the debugging functionality is not found within the JVM itself but is abstracted away into external tools (that are aptly referred to as debuggers), these tools can either reside on the local machine running the JVM being debugged or be run from am external machine.


1 Answers

I suppose you need to look at using a profiler. Or something that uses the instrumentation interface.

Not sure how stable it is, but there is BTrace, which is kind of a Java version of DTrace.

BTrace is a safe, dynamic tracing tool for the Java platform. BTrace can be used to dynamically trace a running Java program. BTrace dynamically instruments the classes of the target application to inject tracing code ("bytecode tracing"). Tracing code is expressed in Java programming language.

If you are doing this on a development machine, and the number of events (resources being loaded) is not too frequent, you could also just set a breakpoint in the debugger.

like image 178
Thilo Avatar answered Sep 28 '22 10:09

Thilo