[posted & e-mailed]
Takeru Tamayama wrote:
> Hi,
> I want to use IrDA on linux & java.
> but, I have a problem in making native method.
> This is very easy test program, bat don't work.
> My jdk is jdk-libc5-1.1.5-v7
>
> I did following commands.
>
> 1.javac HelloWorld.java
> 2.javah -jni HelloWorld
> 3.gcc -fPIC -I/usr/local/java/1.1.5/include
> -I/usr/local/java/1.1.5/include
> -c HelloWorldImp.c
> 4.gcc -shared -Wl,-soname,libHelloWorld.so.1 -o libHelloWorld.so.1.0
> HelloWorld.o
> 5.ln -s libHelloWorld.so.1.0 libHelloWorld.a
>
> following is the source and ERROR message.
> Does anyone have some further information or hints for me what to do ?
> ----
> Takeru Tamayama [EMAIL PROTECTED]
[snip-code + error msgs. (total dump!)]
Hi-
I am using JDK1.1.6 and your HelloWorld works, with a few changes:
2. gcc -fPIC -I/usr/local/jdk1.1.6/include
-I/usr/local/jdk1.1.6/include/genunix -c HelloWorldImp.c
[you need /genunix]
gcc -shared -Wl,-soname,libHelloWorld.so.1 -o libHelloWorld.so.1.0
HelloWorldImp.o
[must be HelloWorldImp.o]
5. ln -sf libHelloWorld.so.1.0 libHelloWorld.so
[if I use libHelloWorld.a (!), I get the reasonable msg. that it can't
find the shared library]
Result:
[user@ravel native]$ java HelloWorld
Hello World !
HTH.
Bob L.
--
Robert Lynch-Berkeley CA [EMAIL PROTECTED]
http://www.best.com/~rmlynch/