Hi ,
I am trying to use jni for making a call to a existing C function thru
Java Now I have started to learn the same .
I have written a small java program called NativeApp.java :- source code is
--------------------------------------------------
class NativeApp {
public static void main(
String[] args){
if (args.length!=1){
System.out.println("Usage:java NativeApp n");
System.exit(0);
}
int n = new Integer(args[0]).intValue();
int answer=new Native().fibonacci(n);
System.out.println(answer);
}
}
--------------------------------------------------
and the corrosponding Native Class Souce code is :-
--------------------------------------------------
class Native
{
public native int fibonacci(int n) ;
static
{
System.loadLibrary("Native");
}
}
--------------------------------------------------
Then I have used the javah -jni Native Command to make the header file.(Successful)
My Os is Solaris and the jdk is 1.2 .
When I try to make the shared library using the following commnad :-
--------------------------------------------------
cc -G -I/fullpath of directory/taxware -I/java/jdk1.1.8/include -I/java/jdk1.1.8/include/solaris NativeImp.c -o Partha.so
--------------------------------------------------
however this gives a error
--------------------------------------------------
Warning: Option -YP,:/usr/ucblib:/opt/SUNWspro/WS6U2/bin/../lib:/opt/SUNW
spro/WS6U2/bin:/usr/ccs/lib:/usr/lib passed to ld, if ld is invoked, ignored oth
erwise
"/user1/xpd2/taxware/jni_md.h", line 24: warning: signed is a keyword in ANSI C
"/user1/xpd2/taxware/jni_md.h", line 24: syntax error before or at: char
"/user1/xpd2/taxware/jni.h", line 107: syntax error before or at: jbyte
"/user1/xpd2/taxware/jni.h", line 107: cannot recover from previous errors
--------------------------------------------------
Can Someone please help me out ?
Thanking you in Anticipation
Partha