Reputation: 7886
Is there a way to set a breakpoint for when a particular Java class is loaded in IntelliJ IDEA?
Upvotes: 4
Views: 4341
Reputation: 1173
In 2016 version it works by setting the breakpoint to the class definition line (public class YourClass ...
). You don't have to use explicit constructor, it stops when ... new YourClass();
is called.
Upvotes: 3
Reputation: 2613
Not that I know of. But if you are trying to determine from where a class is first being loaded, you could put a break point in the constructor (or static fields/block) of the class, and look at the stack trace. That should tell you where the first call to the class is being made.
Upvotes: 2