mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
BugFix: fix integration test setup and GetClassBytesByName test
- tests: rewrite copy-bin.bat with native COPY /Y, cwd-independent paths and error handling so it no longer fails silently when a test JVM is locking resources\libagent.dll - tests: load Target before calling getClassBytesByName, which only resolves classes that are already loaded
This commit is contained in:
1 parent
56a1c32f49
commit
af22f80b23
2 files changed
+33
-4
No files matched your search
@@ -2,13 +2,16 @@ import cn.xiaozhou233.juiceagent.api.JuiceAgent;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class GetClassBytesByName {
|
||||
public static void main(String[] args) throws IOException {
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.load(new File("resources/libagent.dll").getAbsolutePath());
|
||||
JuiceAgent.init("");
|
||||
|
||||
// getClassBytesByName only resolves classes that are already loaded,
|
||||
// so make sure the target class is loaded before looking it up.
|
||||
Class.forName("Target");
|
||||
|
||||
String className = "Target";
|
||||
byte[] bytes = JuiceAgent.getClassBytesByName(className);
|
||||
|
||||
|
||||
Reference in new issue
Block a user