Documentation Contents

# Enhancements in Java SE 6

## for the java.lang.instrument Package

The following functionality has been added to the `java.lang.instrument` package between its initial release in JDK 5.0 and Java™ SE 6.

- Support for retransformation of class files - To facilitate dynamic transformation of classes that have already been loaded, the following methods have been added.
  - `Instrumentation.retransformClasses(Class...)`
  - `Instrumentation.addTransformer(ClassFileTransformer, boolean)`
  - `Instrumentation.isModifiableClass(Class)`
  - `Instrumentation.isRetransformClassesSupported()`
  They are suited to operations such as adding instrumentation to methods whose classes have already been loaded. Support for retransformation means that access to the original class file is no longer required in order to instrument loaded classes. They enable the easy removal of applied transformations and are designed to work in multi-agent environments.
- Support for instrumenting native methods - The following methods allow native methods to be instrumented by providing a JVM-aware mechanism for wrapping the native method.
  - `Instrumentation.setNativeMethodPrefix(ClassFileTransformer, String)`
  - `Instrumentation.isNativeMethodPrefixSupported()`

- Support for appending to class loader search - The following methods allow instrumentation support classes to be defined in the appropriate class loader.

- `Instrumentation.appendToBootstrapClassLoaderSearch(JarFile)`
- `Instrumentation.appendToSystemClassLoaderSearch(JarFile)`

Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.
Contact Us