Java中調用
環境:
JDK:
C:\Documents and Settings\mzq>java
java version
Java(TM) SE Runtime Environment (build
Java HotSpot(TM) Client VM (build
本地代碼編譯環境:
MS Visual Studio
示例代碼如下:
public class JNITest {public static void main (String args[]) { if (args
D:\workspace_java\JNI\src>javac JNITest
D:\workspace_java\JNI\src>javah
注意:代碼擴展名一定要用
根據mynative
#include
將$JAVA_HOME$/include/jni
及mynative
D:\workspace_java\JNI\bin 的目錄
D:\workspace_java\JNI\bin>java JNITest
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26184.html