If you want to arbitrarily pause jvm startup using JDI, you must use the JDI VirtualMachine suspend interface.
However, this does not give you much in terms of being able to connect to the jvmti agent; as another answer indicates, jvmti has its own methods for doing the same.
If you are looking for a way to define arbitrary callbacks for breakpoints, as opposed to calling a specific agent, you might be interested in jdiscript , which is a layer of scripts around JDI that allows you to do such things pretty easily in direct Java, instead of switching to C ++.
source share