Jni ERROR !!
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Partha_Chatterjee
Posted On:   Monday, May 6, 2002 03:47 AM

Hi , I am trying to use jni for making a call to a existing C function thru Java I have written a small java program called NativeApp.java :- source code is -------------------------------------- ---------------------------------- clas s 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.pri ntln(answer); } } -------------- ------------------------------------------ ---------------- and the corrosponding Native Class Souce code is :- --------------   More>>

Hi ,
I am trying to use jni for making a call to a existing C function thru Java
I have written a small java program called NativeApp.java :- source code is
-------------------------------------- ----------------------------------
clas s 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.pri ntln(answer);
}
}
-------------- ------------------------------------------ ----------------
and the corrosponding Native Class Souce code is :-
------------------------------------ ------------------------------------
cl ass Native
{
public native int fibonacci(int n) ;
static
{
System.loadLibrary("Native"); < BR> }
}
---------------------------- ------------------------------------------ --

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 :-
------------------------------------ -------------------------------------
c c -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

   <<Less
About | Sitemap | Contact