code: 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);
          }
      }
docs: Installs a Java agent on a target VM.
  
  @param virtualMachineType The virtual machine type to use for the external attachment.
  @param processId          The id of the process being target of the external attachment.
  @param agent              The Java agent to attach.
  @param argument           The argument to provide or {@code null} if no argument is provided.
  @throws NoSuchMethodException     If the virtual machine type does not define an expected method.
  @throws InvocationTargetException If the virtual machine type raises an error.
  @throws IllegalAccessException    If a method of the virtual machine type cannot be accessed.