在linux 下编译;
javac -d . HelloWorld.java
生成头文件;
javah -jni com.dareway.wmp.test.HelloWorld
编译c++文件;
g++ -o libHelloWorld.so -shared -I/usr/java/jdk1.5.0_05/include -I/usr/java/jdk1.5.0_05/include -I/usr/java/jdk1.5.0_05/include/include/linux HelloWorld.cpp
(注意:名字是 libHelloWorld.so)
执行:
java -Djava.library.path=/usr/liutangxia com.dareway.wmp.test.HelloWorld
小鸥的机器:
装载:./mmfo
测试;./mmfe
卸载:./mmfc
以D:/working/test/src/com/dareway/sms 下JniTest.java为例.
编译 javac -d . JniTest.java
生成头文件; javah -jni com.dareway.sms.JniTest
执行: java -Djava.library.path=/usr/liutangxia com.dareway.sms.JniTest
编译c文件:
cc -s -shared -o libmmfl.so mmfl.c
编译c++:
g++ -o libmmfl.so -shared -I/usr/java/jdk1.5.0_03/include -I/usr/java/jdk1.5.0_03/include -I/usr/java/jdk1.5.0_03/include/linux HelloWorld.cpp
linux下:
/usr/java/jdk1.5.0_03/jre/lib/i386/client:/usr/java/jdk1.5.0_03/jre/lib/i386:/usr/java/jdk1.5.0_03/jre/../lib/i386