diff --git a/README.md b/README.md index 34297e5..3445690 100644 --- a/README.md +++ b/README.md @@ -170,25 +170,7 @@ You can also pass arguments directly: `injector.exe [ #### Method B: Use JNI to call `inject` -Create `cn/xiaozhou233/juiceagent/injector/InjectorNative.java` in your project: - -```java -package cn.xiaozhou233.juiceagent.injector; - -public class InjectorNative { - public native boolean inject(int pid, String path); - public native boolean inject(int pid, String path, String configDir); -} -``` - -Example: - -```java -System.load(""); -InjectorNative injectorNative = new InjectorNative(); - -injectorNative.inject(, "", ""); -``` +See [Inject](doc/Inject.md) ### 5. Done diff --git a/doc/Inject.md b/doc/Inject.md new file mode 100644 index 0000000..2627dcb --- /dev/null +++ b/doc/Inject.md @@ -0,0 +1,26 @@ +# Inject Method + +## Method A: Use `injector.exe` +Run `injector.exe` from `YourDir`. + +```text + +Input PID: +``` + +Enter the PID of the target JVM process and press Enter. + +## Method B: Use JNI to call `inject` +Download the JuiceAgent-JavaInjector-x.x-xxxx.jar from [here](https://github.com/xiaozhou233/JuiceAgent-JavaInjector/releases). + +Add JuiceAgent-JavaInjector-x.x-xxxx.jar to your classpath. + +Example: + +```java +import cn.xiaozhou233.juiceagent.injector.Injector; + +System.load(""); + +Injector.inject(, "", ""); +```