jdk/src/share/classes/java/lang/instrument/package.html
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 1935 4010e03f8c1c
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
<html>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
<head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
<!--
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
  Copyright 2003 Wily Technology, Inc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
-->
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
</head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
<body bgcolor="white">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
Provides services that allow Java programming language agents to instrument programs running on the JVM. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
The mechanism for instrumentation is modification of the byte-codes of methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
<h2>Package Specification</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
<P> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
An agent is deployed as a JAR file. An attribute in the JAR file manifest specifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
agent class which will be loaded to start the agent. For implementations that support a command-line 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
interface, an agent is started by specifying an option on the command-line.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
Implementations may also support a mechanism to start agents some time after the VM has
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
started. For example, an implementation may provide a mechanism that allows a tool to 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
<i>attach</i> to a running application, and initiate the loading of the tool's agent into
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
the running application. The details as to how the load is initiated, is implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
dependent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
<h3>Command-Line Interface</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
<P> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
On implementations with a command-line interface, an agent is started by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
adding this option to the command-line:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
<blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
<code><b>-javaagent:</b></code><i>jarpath[</i><code><b>=</b></code><i>options]</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
</blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
<i>jarpath</i> is the path to the agent JAR file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
<i>options</i> is the agent options.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
This switch may be used multiple times on the same command-line, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
thus creating multiple agents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
More than one agent may use the same <i>jarpath</i>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
An agent JAR file must conform to the JAR file specification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
The manifest of the agent JAR file must contain the attribute <code>Premain-Class</code>. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
value of this attribute is the name of the <i>agent class</i>. The agent class must implement a 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
public static <code>premain</code> method similar in principle to the <code>main</code> application 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
entry point.  After the Java Virtual Machine (JVM) has initialized, each <code>premain</code> method 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
will be called in the order the agents were specified, then the real application
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
<code>main</code> method will be called. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
Each <code>premain</code> method must return in order for the startup sequence to proceed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
The <code>premain</code> method has one of two possible signatures. The JVM first attempts to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
invoke the following method on the agent class:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
<blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
<code>public static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
premain(String agentArgs, Instrumentation inst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
</blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
If the agent class does not implement this method then the JVM will attempt to invoke:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
<blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
<code>public static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
premain(String agentArgs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
</blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
The agent class may also have an <code>agentmain</code> method for use when the agent is started 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
after VM startup. When the agent is started using a command-line option, the <code>agentmain</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
method is not invoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
The agent class will be loaded by the system class loader
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
(see {@link java.lang.ClassLoader#getSystemClassLoader ClassLoader.getSystemClassLoader}). This is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
the class loader which typically loads the class containing the application <code>main</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
The <code>premain</code> methods will be run under the same security and classloader 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
rules as the application <code>main</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
There are no modeling restrictions on what the agent <code>premain</code> method may do.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
Anything application <code>main</code> can do, including creating threads, is legal from <code>premain</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
Each agent is passed its agent options via the <code>agentArgs</code> parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
The agent options are passed as a single string,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
any additional parsing should be performed by the agent itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
If the agent cannot be resolved 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
(for example, because the agent class cannot be loaded,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
or because the agent class does not have an appropriate <code>premain</code> method), the JVM will abort.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
If a <code>premain</code> method throws an uncaught exception, the JVM will abort.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
<h3>Starting Agents After VM Startup</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
An implementation may provide a mechanism to start agents sometime after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
the VM has started. The details as to how this is initiated are implementation 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
specific but typically the application has already started and its <code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
main</code> method has already been invoked. In cases where an implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
supports the starting of agents after the VM has started the following applies:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
<ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
  <li><p>The manifest of the agent JAR must contain the attribute <code>Agent-Class</code>. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
      The value of this attribute is the name of the <i>agent class</i>. </p></li> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
      
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
  <li><p>The agent class must implement a public static <code>agentmain</code> method. </p></li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
  <li><p>The system class loader (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
      {@link java.lang.ClassLoader#getSystemClassLoader ClassLoader.getSystemClassLoader}) must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
      support a mechanism to add an agent JAR file to the system class path. <p></li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
</ol>  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
The agent JAR is appended to the system class path. This is the class loader that typically loads 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
the class containing the application <code>main</code> method. The agent class is loaded and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
JVM attempts to invoke the <code>agentmain</code> method. The JVM first attempts to invoke 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
the following method on the agent class:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
<blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
<code>public static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
agentmain(String agentArgs, Instrumentation inst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
</blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
If the agent class does not implement this method then the JVM will attempt to invoke:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
<blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
<code>public static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
agentmain(String agentArgs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
</blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
The agent class may also have an <code>premain</code> method for use when the agent is started
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
using a command-line option. When the agent is started after VM startup the <code>premain</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
method is not invoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
The agent is passed its agent options via the <code>agentArgs</code> parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
The agent options are passed as a single string,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
any additional parsing should be performed by the agent itself. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
<P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
The <code>agentmain</code> method should do any necessary initialization 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
required to start the agent. When startup is complete the method should 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
return. If the agent cannot be started
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
(for example, because the agent class cannot be loaded,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
or because the agent class does not have a conformant <code>agentmain</code> method), the JVM will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
not abort. If the <code>agentmain</code> method throws an uncaught exception it will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
<h3>Manifest Attributes</h3>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
The following manifest attributes are defined for an agent JAR file:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
<blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
<dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
<dt><code>Premain-Class</code></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
<dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                        When an agent is specified at JVM launch time this attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
			specifies the agent class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
			That is, the class containing the <code>premain</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                        When an agent is specified at JVM launch time this attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
			is required. If the attribute is not present the JVM will abort.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                        Note: this is a class name, not a file name or path.							
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
<dt><code>Agent-Class</code></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
<dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                        If an implementation supports a mechanism to start agents 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                        sometime after the VM has started then this attribute specifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                        the agent class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                        That is, the class containing the <code>agentmain</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                        This attribute is required, if it is not present the agent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                        will not be started.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                        Note: this is a class name, not a file name or path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
</dd>			
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
<dt><code>Boot-Class-Path</code></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
<dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                        A list of paths to be searched by the bootstrap class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                        loader. Paths represent directories or libraries
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                        (commonly referred to as JAR or zip libraries on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                        many platforms). 			
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                        These paths are searched by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                        bootstrap class loader after the platform specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                        mechanisms of locating a class have failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                        Paths are searched in the order listed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                        Paths in the list are separated by one or more spaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                        A path takes the syntax of the path component of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                        hierarchical URI. The path is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                        absolute if it begins with a slash character ('/'),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                        otherwise it is relative. A relative path is resolved
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                        against the absolute path of the agent JAR file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                        Malformed and non-existent paths are ignored.	
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
			When an agent is started sometime after the VM has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
			started then paths that do not represent a JAR file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
			are ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                        This attribute is optional.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
<dt><code>Can-Redefine-Classes</code></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
<dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                        Boolean (<code>true</code> or <code>false</code>, case irrelevant).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                        Is the ability to redefine classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                        needed by this agent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                        Values other than <code>true</code> are considered <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                        This attribute is optional, the default is <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
<dt><code>Can-Retransform-Classes</code></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
<dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                        Boolean (<code>true</code> or <code>false</code>, case irrelevant).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                        Is the ability to retransform classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                        needed by this agent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                        Values other than <code>true</code> are considered <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                        This attribute is optional, the default is <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
<dt><code>Can-Set-Native-Method-Prefix</code></dt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
<dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                        Boolean (<code>true</code> or <code>false</code>, case irrelevant).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                        Is the ability to set native method prefix needed by this agent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                        Values other than <code>true</code> are considered <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                        This attribute is optional, the default is <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
</dd>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
</dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
</blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
<p> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
An agent JAR file may have both the <code>Premain-Class</code> and <code>Agent-Class</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
attributes present in the manifest. When the agent is started on the command-line using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
the <code>-javaagent</code> option then the <code>Premain-Class</code> attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
specifies the name of the agent class and the <code>Agent-Class</code> attribute is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
ignored. Similarly, if the agent is started sometime after the VM has started, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
the <code>Agent-Class</code> attribute specifies the name of the agent class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
(the value of <code>Premain-Class</code> attribute is ignored).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
<h2>Related Documentation</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
For tool documentation, please see:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
  <li><a href="{@docRoot}/../technotes/tools/index.html">JDK Tools and Utilities</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
@since JDK1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
@revised 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
</body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
</html>