How can I use java.lang.instrument in an Eclipse RCP application?
问题 In order to use the instrumentation features introduced in JDK 5, you can use the -javaagent flag passed to the JVM. This will inject an instance of an Instrumentation class into the static premain method. For example in a class like this: public class MyClass { public static Instrumentation inst; public static void premain(String options, Instrumentation inst) { MyClass.inst = inst; } } With an appropriate manifest file, you can run this as follows: java -javaagent:myfiles.jar SomeClass This