When using the Java Attach API I get the following Linux link error (only for checking on different machines):
Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.tools.attach.WindowsAttachProvider.tempPath()Ljava/lang/String; at sun.tools.attach.WindowsAttachProvider.tempPath(Native Method) at sun.tools.attach.WindowsAttachProvider.isTempPathSecure(WindowsAttachProvider.java:74) at sun.tools.attach.WindowsAttachProvider.listVirtualMachines(WindowsAttachProvider.java:58) at com.sun.tools.attach.VirtualMachine.list(VirtualMachine.java:134) at sun.tools.jconsole.LocalVirtualMachine.getAttachableVMs(LocalVirtualMachine.java:151) at sun.tools.jconsole.LocalVirtualMachine.getAllVirtualMachines(LocalVirtualMachine.java:110) ...
Interestingly, on Solaris and Windows, it works out of the box.
I tried several combinations, specifying java.library.path to point to the directory containing libattach.so , but with no luck.
What is wrong here?
And as a bonus question:
Is there any way to see which native library is actually associated with the java class?
source share