redefine en

This commit is contained in:
LHearen committed 2018-09-21 11:49:27 +08:00
1 parent fe44e00bd1
commit 7ec6722214
1 file changed
+26
+26
View File
@@ -0,0 +1,26 @@
redefine
========
Load the external `*.class` files and *re-define* the JVM-loaded classes.
Reference: [Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-)
F.Y.I
1. Re-defined classes cannot be restores any more;
2. Re-definition can fail (like adding a new field); for more information, please refer to JDK documentation
### Options
|Name|Specification|
|---:|:---|
|[c:]|hashcode of the class loader|
|[p:]|absolute path of the external `*.class` (multiple paths supported)|
### Usage
```
redefine -p /tmp/Test.class
redefine -c 327a647b -p /tmp/Test.class /tmp/Test\$Inner.class
```