protected static void install ( Class < ? > virtualMachineType , String processId , String agent , String argument ) throws NoSuchMethodException , InvocationTargetException , IllegalAccessException { Object virtualMachineInstance = virtualMachineType . getMethod ( ATTACH_METHOD_NAME , String . class ) . invoke ( STATIC_MEMBER , processId ) ; try { virtualMachineType . getMethod ( LOAD_AGENT_METHOD_NAME , String . class , String . class ) . invoke ( virtualMachineInstance , agent , argument ) ; } finally { virtualMachineType . getMethod ( DETACH_METHOD_NAME ) . invoke ( virtualMachineInstance ) ; } }
Installs a Java agent on a target VM .