- Step 1: Write the Java Code 带有本地接口(native)
- Step 2: Compile the Java Code
- Step 3: Create the .h File javah.exe
javah -classpath [wherever you compiled HelloWorld] -o HelloWorld.h example.jni.HelloWorld
- Step 4: Write the Native Method Implementation (用 CDT+MinGW )
- Step 5: Create a Shared Library
- Step 6: Run the Program
产生dll:
gcc -mno-cygwin -ID:\JDK\JDK1.4/include -ID:\JDK\JDK1.4/include/win32 -Wl,--add-stdcall-alias -shared -o HelloWorld.dll HelloWorld.c
ref:
http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html
http://www.inonit.com/cygwin/jni/helloWorld/
调试集成 Java 和 C/C++ 的代码
0 Comments:
Post a Comment
<< Home