1
發現一個錯誤,當我運行這段代碼,這是我用JNIJNI程序運行
$ javac HelloWorld.java
$ javah -jni HelloWorld
$ LD_LIBRARY_PATH=.
$ export LD_LIBRARY_PATH
$ gcc -I/usr/lib/jvm/java-6-openjdk /include -o libHelloWorld.so -shared HelloWorld.c -fPIC
$ java -Djava.library.path=. HelloWorld
*** glibc detected *** java: munmap_chunk(): invalid pointer: 0x00007f89713b5736 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x776b6)[0x7f89782ca6b6]
/home/ushusadmin/libHelloWorld.so(Java_HelloWorld_nativeHelloWorld+0x82) [0x7f89713b56de]
[0x7f8972e1dd68]
======= Memory map: ========
00400000-00409000 r-xp 00000000 08:11 1984203 /usr/lib
.
.
.
.
.
7f8976c97000-7f8976e96000 ---p 00007000 08:11 9175206 /lib/x86_64- linux-gnu/librt-2.13.soAborted
出現此錯誤,請給我一個建議來解決這個錯誤,, 感謝第一個程序,