Skip to content
Advertisement

how to fix java.lang.UnsatisfiedLinkError: sun.tools.attach.BsdVirtualMachine.createAttachFile(Ljava/lang/String;)

everyone.

I was trying to execute ” mvn clean test ” to verify a simple maven project which was generated by “mvn archetype:generate”.I just to want learning how to write unit test.But I got a exception , after a long time debug and trying , I don’t know how to continue,please give me some advice. Because I don’t know what’s wrong, so I will try to give as much info as I can.

os:

JavaScript

jdk:

JavaScript

maven: apache-maven-3.8.1(I also tried 3.6.3)

pom.xml:

JavaScript

main java code :

JavaScript

test java code:

JavaScript

stack trace info:

JavaScript

what I have tried: I tried to debug and I got this in class BsdVirtualMachine.class

JavaScript

and it invoke in ClassLoader.class :

JavaScript

It seems a native method createAttachFile(String path) tried to create a file ,and the ClassLoader was trying to load this native method from local, but it can not find this method in /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/libattach.dylib ( I find this by debuging). so, what can I do to fix this problem?and I don’t know how to do next.could someone help me?

Advertisement

Answer

With @Mells ‘s help, I post this issue to the developers of jmockit (for more please check github) and the developer told me that this was because zulujdk8 remove the native method.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement