以下是官方網(wǎng)站的介紹:https://jna.dev.java.net
Java Native Access (JNA)
JNA provides Java programs easy access to native shared libraries (DLLs on Windows) without writing anything but Java code—no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes. Access is dynamic at runtime without code generation.
JNA's design aims to provide native access in a natural way with a minimum of effort. No boilerplate or generated code is required. While some attention is paid to performance, correctness and ease of use take priority.
The JNA library uses a small native library stub to dynamically invoke native code. The developer uses a Java interface to describe functions and structures in the target native library. This makes it quite easy to take advantage of native platform features without incurring the high overhead of configuring and building JNI code (overhead would otherwise increase with each supported platform).
The JavaDoc is available online, which includes an overview of specific usage.
NOTE: Sun is not sponsoring this project, even though the package name (com.sun.jna
) might imply otherwise.
This library is provided under the LGPL, version 2.1 or later.
Java Native Access (JNA)
com.sun.jna
) might imply otherwise.
以后只要系統(tǒng)上有的動態(tài)鏈接庫,就可以直接調(diào)用了,再也不用定義本地方法,然后生成頭文件,然后去實現(xiàn)了。這么好的工具,怎么能不去研究一下呢,研究的過程中,我會把它寫成文章,與大家分享:)
盡管千里冰封
依然擁有晴空
你我共同品味JAVA的濃香.