Java Native Interface技術(shù)研究、設(shè)計(jì)與實(shí)踐
打開(kāi)文本圖片集
摘要:文章研究Java程序與本機(jī)代碼交互的機(jī)制,它通過(guò)在Java虛擬機(jī)(JVM)和本機(jī)代碼之間提供一組接口來(lái)實(shí)現(xiàn)。JNI可用于訪問(wèn)本機(jī)庫(kù)、函數(shù)和數(shù)據(jù)結(jié)構(gòu)。通過(guò)具體實(shí)例的實(shí)現(xiàn),驗(yàn)證了在保持Java平臺(tái)無(wú)關(guān)性的同時(shí)又充分發(fā)揮了本地平臺(tái)的優(yōu)勢(shì)。
關(guān)鍵詞:Java;JNI;Win32
doi:10.3969/J.ISSN.1672-7274.2024.04.026
中圖分類號(hào):TP 309;TP 311.52 文獻(xiàn)標(biāo)志碼:B 文章編碼:1672-7274(2024)04-00-03
Research, Design, and Practice of Java Native Interface Technology
LIU Yulong1, ZHU Wensong2
(1. Graduate School of Anhui Jianzhu University, Hefei 230022, China;
2. Xianheng International Technology Co., Ltd., Hangzhou 310000, China)
Abstract: This article investigates the mechanism of interaction between Java programs and native code, which is achieved by providing a set of interfaces between the Java Virtual Machine (JVM) and native code. JNI can be used to access native libraries, functions, and data structures. Through the implementation of specific examples, it has been verified that the advantages of the local platform are fully utilized while maintaining Java platform independence.
Keywords: Java; JNI; Win32
在工程開(kāi)發(fā)過(guò)程中,使用“純Java”代碼的解決方案是非常好的,但是有時(shí)候某些功能必須引入其他語(yǔ)言的支持。(剩余4500字)