Package com.avrix.agent
Class Agent
java.lang.Object
com.avrix.agent.Agent
The Agent class represents a Java instrumentation agent used for dynamic manipulation of the Java runtime environment.
This class allows you to set a
Instrumentation
object for later use in the agent.-
Field Summary
Modifier and TypeFieldDescriptionstatic Instrumentation
AInstrumentation
object used by the agent to access class data and load it into the JVM. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addClassPath
(File jarFile) Adds a JAR file to the system classpath.static void
agentmain
(String agentArgs, Instrumentation inst) The agentmain method is called when the agent is loaded into a running virtual machine (JVM).
-
Field Details
-
instrumentation
AInstrumentation
object used by the agent to access class data and load it into the JVM.
-
-
Constructor Details
-
Agent
public Agent()
-
-
Method Details
-
agentmain
The agentmain method is called when the agent is loaded into a running virtual machine (JVM). It sets up aInstrumentation
object for later use in the agent.- Parameters:
agentArgs
- the agent arguments passed when it was launchedinst
-Instrumentation
object providing access to the JVM
-
addClassPath
public static void addClassPath(File jarFile) throws NoSuchMethodException, IOException, InvocationTargetException, IllegalAccessException Adds a JAR file to the system classpath.- Parameters:
jarFile
- the JAR file to be added to the classpath.- Throws:
IllegalStateException
- if the instrumentation agent is not initialized.NoSuchMethodException
- if the method to add URL to classloader is not found.IOException
- if there is an I/O error while accessing the JAR file.InvocationTargetException
- if there is an error invoking the method to add URL.IllegalAccessException
- if access to the method to add URL is denied.
-