在我的Windows机器上使用com.sun.tools.attach API时,在拨打电话时出现以下错误
VirtualMachine.list()
Run Code Online (Sandbox Code Playgroud)
java.lang.UnsatisfiedLinkError:java.library.path中没有附加
原因是缺少attach.dll.attach.dll位于$JRE/bin/.启动我的Java程序时,-Djava.library.path=[Directory to the attach.dll]一切都没有错误输出.
现在,我不想添加每个Java程序启动这个丑陋的JVM参数.因此我的问题是:
我的机器配置不正确,$JRE/bin/应该在库路径中吗?
如果没有,我该如何动态添加路径?System.setProperties("java.library.path",StringOfThePathToTheAttach.dll);没有成功.库路径已更改,但无论如何都会出现错误.这与SecurityManager或JVM的启动有关吗?