博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
System.LoadLibrary
阅读量:6321 次
发布时间:2019-06-22

本文共 2075 字,大约阅读时间需要 6 分钟。

System.loadLibary()

 

 

http://dikar.iteye.com/category/23294

http://blog.csdn.net/zhangao0086/article/details/6395002
http://cab0605.iteye.com/blog/154701 

 

 

The parameter to should be the name of the libary, without path, extension or "lib":

1 System.loadLibrary("payment");

Depending on your platform, this will load libpayment.so or payment.dll.

Although it is not an error to call System.loadLibrary() multiple times, loading the libraries is often done in a :

1 class Test {
2     static {
3         System.loadLibrary("payment");
4     }
5 }

java.library.path

Java searches several directories for this libary file. The directories to search are specified in the property java.library.path. On Linux, this is a copy of the environment variable . On Windows, it is a copy of the PATH variable.

Although changing the java.library.path has influence on how Java loads its libraries, it has no effect on Windows. When your library depends on other DLLs, these are loaded without taking java.library.path into account. If the library you load needs another library, which can not be found, you get an UnsatisfiedLinkError with the message "". To solve this, you can load the dependant libraries yourself using multiple calls to System.loadLibrary(), loading all libaries one by one.

When the library can not be found, you get a with the message "no library in java.library.path". To solve this, move the library in one of the directories specified by java.library.path or alter the property so that it points to the directory containing your library. (read ). You can print this property with the following code:

1 System.out.println(System.getProperty("java.library.path"));

Method decoration

Another possibility when things do not work is when the DLL can be found, but the methods can not. A DLL exports functions according to specific names an calling conventions. When your compiler is not configured the right way your methods may get another name than they should be. To solve this, you should include the header file generated by and configure your compiler the right way (read about , ).

你可能感兴趣的文章
React事件处理之连蒙带猜
查看>>
2019年抗投诉红包互换系统源码
查看>>
Leetcode PHP题解--D76 993. Cousins in Binary Tree
查看>>
Oracle 命令使用大全
查看>>
Effective Object C 2.0 『熟悉Object C』
查看>>
python可迭代对象
查看>>
React项目中使用dagre-d3
查看>>
凌晨3点不回家:成年人的世界不是他们说的那样
查看>>
NOW直播——Flutter组件化开发方案
查看>>
如何用node.js创建一个应用
查看>>
GMQ致力于加速区块链应用实现快速落地
查看>>
朱晔的互联网架构实践心得S2E7:漫谈平台架构的工作(基础架构、基础服务、基础平台、基础中间件等等)...
查看>>
最终还是决定用SCSS,记录下SCSS的语法
查看>>
华为4.0系统怎么没ROOT激活xposed框架的经验
查看>>
微信小程序用户昵称emoji乱码问题
查看>>
前端知识梳理
查看>>
JavaScript-实例属性与原型属性区别
查看>>
使用代理ip防止爬虫被封ip(附亿牛云代理开发过程)
查看>>
【译】Java8官方教程:数值类
查看>>
NODE基础概念
查看>>