Oracle Java supports 2 ways of instrumenting JVM processes:
- via CLI specifying -javaagent:jarpath,
- starting agents after the JVM startup.
Which method does OneAgent use and why?
Why is it not possible to do Java code injection on the fly without java process restart?
AFAIK OneAgent uses JVMTI to instrument the JVM itself. But there is also a native part of oneagent (library written in C++) linked to your JVM process. I don't think you can add any library with such functionality on the fly to any process.