How to debug a Java agent

Currently, it is possible to run the JVM using the agent:

-javaagent:somejar.jar

so that to run the Java agent that I wrote, since I have to put it in a jar. therefore it is limited when debugging. Is there a way to debug a Java agent in the IDE when connecting to the JVM?

+4
source share
1 answer

The debugging API does not distinguish between a Java agent and "normal" code. If, for example, you support the sources of your agents in one project, you can set breakpoints as you expect. Then your IDE will simply register the source file names and line numbers in the debug API, as is usually the case.

+4

Source: https://habr.com/ru/post/1623910/


All Articles