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

          以下是官方網(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.

           


          以后只要系統(tǒng)上有的動態(tài)鏈接庫,就可以直接調(diào)用了,再也不用定義本地方法,然后生成頭文件,然后去實現(xiàn)了。這么好的工具,怎么能不去研究一下呢,研究的過程中,我會把它寫成文章,與大家分享:)






          盡管千里冰封
          依然擁有晴空

          你我共同品味JAVA的濃香.
          posted on 2007-10-24 09:37 千里冰封 閱讀(6338) 評論(4)  編輯  收藏 所屬分類: JAVA擴展

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

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

          咱也看看jna,希望好用  回復  更多評論
            
          主站蜘蛛池模板: 久治县| 万宁市| 白玉县| 广西| 苍南县| 长葛市| 卢龙县| 临清市| 灵寿县| 灌云县| 阳西县| 阿拉尔市| 布拖县| 安新县| 抚松县| 砀山县| 陆川县| 遵义市| 长沙市| 米脂县| 牟定县| 澳门| 瓮安县| 宁河县| 南和县| 静乐县| 阜康市| 金沙县| 东至县| 贵阳市| 吴桥县| 叙永县| 磐石市| 同心县| 利川市| 平安县| 宁都县| 金堂县| 渭源县| 香河县| 虹口区|