千里冰封
          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 千里冰封 閱讀(6336) 評論(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,希望好用  回復  更多評論
            
          主站蜘蛛池模板: 揭西县| 阜南县| 简阳市| 福建省| 宜章县| 共和县| 贡山| 沐川县| 常山县| 临湘市| 南部县| 泸水县| 阿合奇县| 闽侯县| 竹山县| 涪陵区| 巴南区| 镇康县| 蓬溪县| 黎平县| 宜君县| 贵南县| 娄底市| 那曲县| 塔河县| 唐山市| 云安县| 天气| 毕节市| 玉环县| 剑川县| 辉南县| 五华县| 平罗县| 静安区| 夏津县| 株洲市| 琼结县| 宁夏| 沂源县| 南雄市|