Class Attacher


  • public class Attacher
    extends java.lang.Object
    A Java program that attaches a Java agent to an external process.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static void install​(java.lang.Class<?> virtualMachineType, java.lang.String processId, java.lang.String agent, java.lang.String argument)
      Installs a Java agent on a target VM.
      static void main​(java.lang.String[] args)
      Runs the attacher as a Java application.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
        Runs the attacher as a Java application.
        Parameters:
        args - A list containing the fully qualified name of the virtual machine type, the process id, the fully qualified name of the Java agent jar followed by an empty string if the argument to the agent is null or any number of strings where the first argument is proceeded by any single character which is stripped off.
      • install

        protected static void install​(java.lang.Class<?> virtualMachineType,
                                      java.lang.String processId,
                                      java.lang.String agent,
                                      java.lang.String argument)
                               throws java.lang.NoSuchMethodException,
                                      java.lang.reflect.InvocationTargetException,
                                      java.lang.IllegalAccessException
        Installs a Java agent on a target VM.
        Parameters:
        virtualMachineType - The virtual machine type to use for the external attachment.
        processId - The id of the process being target of the external attachment.
        agent - The Java agent to attach.
        argument - The argument to provide or null if no argument is provided.
        Throws:
        java.lang.NoSuchMethodException - If the virtual machine type does not define an expected method.
        java.lang.reflect.InvocationTargetException - If the virtual machine type raises an error.
        java.lang.IllegalAccessException - If a method of the virtual machine type cannot be accessed.