【求助】 在用com.sun.tools.attach.VirtualMachine的时候出现AttachNotSupportedException异常

来源:互联网 发布:海迈预算软件 编辑:程序博客网 时间:2024/05/20 19:49


LoadAgent.java如下 :

import java.io.IOException;



import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
/**
 * @author z00174343
 *
 */
public class LoadAgent {


/**
* @param args
*/
public static void main(String[] args) throws AttachNotSupportedException,IOException,AgentLoadException,AgentInitializationException  {
// TODO Auto-generated method stub
        VirtualMachine vm = VirtualMachine.attach(args[0]);
        vm.loadAgent(args[1]);
}

}

抛出异常:


E:\wokspace\Demo1\src>java LoadAgent 4456 "E:\wokspace\Demo1\src\agent_fuckallbt
n.jar"
java.lang.UnsatisfiedLinkError: no attach in java.library.path
Exception in thread "main" com.sun.tools.attach.AttachNotSupportedException: no
providers installed
        at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:190)
        at LoadAgent.main(LoadAgent.java:21)



注:我在其它电脑上就可以运行.

原创粉丝点击