Mac使用z3报Exception in thread “main“ java.lang.UnsatisfiedLinkError: no libz3java in java.library.path
2021/8/7 17:07:58
本文主要是介绍Mac使用z3报Exception in thread “main“ java.lang.UnsatisfiedLinkError: no libz3java in java.library.path,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
原文: https://blog.csdn.net/lunarych/article/details/107835522
网上找了很多mac的解决方案都是要设置DYLD_LIBRARY_PATH或者java.library.path,但是都没用,在GitHub上找到的答案:
原因:https://github.com/Z3Prover/z3/issues/294
Java是受SIP保护的可执行文件,它会忽略用户设置 DYLD_LIBRARY_PATH
Proof by running: /bin/ls -lO $(which java)
libz3.dylib 不在操作系统OS X的标准位置之一 : not in ~/lib, /usr/local/lib, /usr/lib
所以快速解决方案是移动或链接 libz3.dylib 到 ~/lib.
put JNI dynamic link libraries in: /Library/Java/Extensions
e.g.libz3java.dylib
put none-JNI dynamic link libraries in: /usr/local/lib
e.g. libz3.dylib
即:将libz3java.dylib放到 /Library/Java/Extensions中,libz3.dylib放到/usr/local/lib中
https://github.com/Z3Prover/z3/issues/4979
Hi,
I’m using z3 java bindings in a project (https://github.com/uclid-org/uclid) on Big Sur 11.1, and I think I am running into issue #294 again:
I’ve tried the solution in that thread, which worked on my intel mac on Mojave and Catalina with openJDK11 (and also openJDK8 but it didn’t work with a later version of openJDK):
put JNI dynamic link libraries in: /Library/Java/Extensions
e.g. libz3java.dylib
put none-JNI dynamic link libraries in: /usr/local/lib
e.g. libz3.dylib
As far as I can tell, this solution doesn’t work on BigSur and I get the error:
Exception in thread “main” java.lang.UnsatisfiedLinkError: no libz3java in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1875)
at java.lang.Runtime.loadLibrary0(Runtime.java:872)
The only way I can fix this error is to put libz3.dylib in the same directory that I call the binary from (I can leave libz3java.dylib in /Libary/Java/Extensions).
I’ve recreated this on two different setups:
• BigSur 11.1 on an M1 macbook, with zulu openjdk version 1.8.0_282 , and z3 4.8.11
• BigSur 11.1 on an intel macbook with AdoptOpenJDK11 and z3 4.8.8
Has anyone else encountered this and got a solution?
我的解决方案是直接在项目根目录 . 下添加 libz3java.dylib libz3.dylib
因为报错信息显示 /Library/Java/Extensions /usr/local/lib . 等目录缺少上述两个文件
这篇关于Mac使用z3报Exception in thread “main“ java.lang.UnsatisfiedLinkError: no libz3java in java.library.path的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-11有哪些好用的家政团队管理工具?
- 2025-01-11营销人必看的GTM五个指标
- 2025-01-11办公软件在直播电商前期筹划中的应用与推荐
- 2025-01-11提升组织效率:上级管理者如何优化跨部门任务分配
- 2025-01-11酒店精细化运营背后的协同工具支持
- 2025-01-11跨境电商选品全攻略:工具使用、市场数据与选品策略
- 2025-01-11数据驱动酒店管理:在线工具的核心价值解析
- 2025-01-11cursor试用出现:Too many free trial accounts used on this machine 的解决方法
- 2025-01-11百万架构师第十四课:源码分析:Spring 源码分析:深入分析IOC那些鲜为人知的细节|JavaGuide
- 2025-01-11不得不了解的高效AI办公工具API