跳到主要内容

Could not find agent library native-image-agent on the library path

问题描述

当执行graalvm的跟踪代理时

/usr/local/graalvm/graalvm-ee-java17-22.2.0/bin/java -agentlib:native-image-agent=config-output-dir=META-INF/native-image -jar ./app.jar

抛出异常

Could not find agent library native-image-agent on the library path, with error: libnative-image-agent.so: cannot open shared object file: No such file or directory

问题解决

在你安装的graalvm jdk下执行安装Native Image

./gu install native-image

回到graalvm lib目录下,比如:/usr/local/graalvm/graalvm-ce-java17-22.2.0/lib 可以看到已经有文件libnative-image-agent.so