DYLD_LIBRARY_PATH Mac 开发问题 java.lang.UnsatisfiedLinkError

DYLD_LIBRARY_PATH 是 Mac 的环境变量。在项目中主要是在MAC OS X 系统中添加libXX.jnilib,以实现Java JNI。

如果不添加这个环境变量,Java 报错:java.lang.UnsatisfiedLinkError: no XX in java.library.path。

 

以下是Apple 的在线文档关于 DYLD_LIBRARY_PATH 说明。

DYLD_LIBRARY_PATH

This is a colon separated list of directories that contain libraries. The dynamic linker
searches these directories before it searches the default locations for libraries. It allows
you to test new versions of existing libraries.

For each library that a program uses, the dynamic linker looks for it in each directory in
DYLD_LIBRARY_PATH in turn. If it still can't find the library, it then searches DYLD_FALL-BACK_FRAMEWORK_PATH DYLD_FALLBACK_FRAMEWORK_PATH
BACK_FRAMEWORK_PATH and DYLD_FALLBACK_LIBRARY_PATH in turn.

Use the -L option to otool (1) . to discover the frameworks and shared libraries that the exe-cutable executable
cutable is linked against.

可以在Java 中通过System 类察看属性
java.library.path
System.getProperty("java.library.path");
可以发现,通过
DYLD_LIBRARY_PATH 加入的系统环境变量,出现在属性中。

当然,这只是在Mac OS X 系统中。
在Linux 系统中对应的环境变量是:LD_LIBRARY_PATH。
在Window 系统中对应的变量是:Path。(可能是)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值