使用Java Attach API,我可以将java代理(例如jar文件)加载到我的目标程序中。
下面是我的代码。
import com.sun.tools.attach.*;
String javaAgentPath = "C:\\agent\\jAgent.jar";
VirtualMachine vm = VirtualMachine.attach(PID);
vm.loadAgent(javaAgentPath, null);连接到正在运行的JVM并加载我的代理jar文件工作得很好。现在我想要卸载我的代理jarfile,但是Attach API没有提供unloadAgent()方法。
有没有办法卸载我的javaagent文件?
发布于 2016-12-21 21:06:14
vm.detatch()就是你要找的东西
https://stackoverflow.com/questions/28802893
复制相似问题