JNI技术(Java Native Interface)
来源:互联网 发布:c语言数组源代码 编辑:程序博客网 时间:2024/05/18 02:40
说白了,就是JAVA调用由C/C++编写的库文件DLL(WINDOWS)/SO(UNIX)
- public class testdll
- {
- static
- {
- System.loadLibrary("goodluck");
- }
- public native static int get();
- public native static int set(int a);
- public static void main(String[] args)
- {
- testdll test = new testdll();
- test.set(10);
- System.out.println(test.get());
- }
- }
用javac testdll.java编译它,会生成testdll.class。
再用javah testdll,则会在当前目录下生成testdll.h文件,这个文件需要被C/C++程序调用来生成所需的库文件。
将testdll.h和include/下的jni.h作为头文件,实现
JNIEXPORT jint JNICALL Java_testdll_get (JNIEnv *, jclass); 和
JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint);
生成goodluck.dll文件。就ok啦
- JNI技术(Java Native Interface)
- JNI技术(Java Native Interface)
- java native interface(JNI)技术简单应用
- JNI:Java Native Interface
- JNI(java native interface)
- JNI - Java Native Interface
- JNI:Java Native Interface
- Java Native Interface (JNI)
- Java Native Interface (JNI)
- JNI:Java Native Interface
- JNI:Java Native Interface
- Android JNI(Java Native Interface)技术介绍
- JNI (Java Native Interface)是什么
- Java Native Interface(JNI)简介
- JNI(Java Native Interface)
- Java Native Interface Specification(JNI)
- Java Native Interface (JNI)简介
- JNI(Java Native Interface)_01
- HTTP Post 文件的一些细节
- 写在最前面
- Java中什么集合查询最快
- AX开发拾荒
- 哈佛图书馆墙上的训言
- JNI技术(Java Native Interface)
- WAP
- mysql 权限控制笔记
- ae创建平头buffer
- 一组常用的弹出窗口用法总结
- Google SiteMap Protocol
- LR录制中出现的问题
- PHP(将16进制色彩转换成RGG色)
- 巧用批处理解决IE不支持JavaScript等问题