千里冰封
          JAVA 濃香四溢
          posts - 151,comments - 2801,trackbacks - 0
          前幾天寫了一個如何寫JNI的文章,說的是調用本地方法,昨天在ruislan的博客里面看到了他寫的一個關于窗體的透明和變換的,里面提到了JNA,然后我去JNA的網站一看,呵呵,還真不錯,它不但可以做到窗體的透明和變換,還可以完全調用本地的動態鏈接庫文件,并且還在一定的程度上跨了平臺。

          以下是官方網站的介紹: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的濃香.
          posted on 2007-10-24 09:37 千里冰封 閱讀(6346) 評論(4)  編輯  收藏 所屬分類: JAVA擴展

          FeedBack:
          # re: JNA介紹
          2007-10-25 08:55 | 阿蜜果
          官方網站的介紹的那部分字體好刺眼啊,呵呵
          關注起JNA來了。。。  回復  更多評論
            
          # re: JNA介紹
          2007-10-25 09:06 | 千里冰封
          呵呵,怎么變成這樣了,在FF下面看到不是這樣子的啊  回復  更多評論
            
          # re: JNA介紹
          2007-11-27 20:34 | 隔葉黃鶯
          我研究并寫過兩篇 JNative 調用動態庫的日志,也是能跨平臺的。直接調用,不用寫自己的動態庫。有時間也研究一下JNA,希望能與樓主共勉。  回復  更多評論
            
          # re: JNA介紹
          2008-04-05 13:33 | fenixshadow
          支持支持,jni根本不敢用,太麻煩了。

          還不如在java中把腳本寫死:vb\perl等,然后直接調用。

          咱也看看jna,希望好用  回復  更多評論
            
          主站蜘蛛池模板: 弥渡县| 陈巴尔虎旗| 永福县| 蒙阴县| 察哈| 攀枝花市| 新巴尔虎左旗| 固阳县| 昂仁县| 东乌珠穆沁旗| 思南县| 嘉定区| 沭阳县| 桑植县| 筠连县| 罗甸县| 秦皇岛市| 漳平市| 彭泽县| 阿鲁科尔沁旗| 十堰市| 南汇区| 浦江县| 邯郸县| 黔西| 安康市| 新建县| 屯门区| 高台县| 孝感市| 长治县| 祁连县| 梁山县| 女性| 衡东县| 临江市| 宣恩县| 正宁县| 综艺| 兰西县| 泰宁县|