thanks for quick reply but my situation is
for example:
some coder done this like steps
gcc -c -fPIC calc_mean.c -o calc_mean.o
gcc -shared -Wl,-soname,libmean.so.1 -o libmean.so calc_mean.o
provided only libmean.so not code and i know it contain api as float mean_value(int a,int b);
so have written code like
#include "JNIDemo.h"
JNIEXPORT void JNICALL Java_JNIDemo_display(JNIEnv *env, jobject obj)
{
int a,b;
float result;
printf("enter two values\n");
scanf("%d %d",&a,&b);
result=mean_value(a,b);
printf("result is %f",result);
}
JavaDemo.c
public class JNIDemo
{
public native void display();
static
{
System.loadLibrary("mean");
System.loadLibrary("nativecode");
}
public static void main(
String args[])
{
try
{
JNIDemo jdo=new JNIDemo();
jdo.display();
}
catch(Exception e)
{
System.out.println("Alert Alert Alert:"+e.getMessage());
}
}
}
}
now i have done
1)cc -o libnativecode.so -shared -I/JDK/include -I/JDK/include/linux NativeCode.c
2)export LD_LIBRARY_PATH=`pwd`
3)java JNIDemo
then it giving error "java.lang.UnsatisfiedLinkError"
please help me i just want to use that .so file apis in java
please
i was getting result for .so files which is compiled using java library's but my case is different
iam very new to java (frankly very beginner )
please help me out
it is very urgent, tell me is it possible to use c library (which is compiled with out java libraries) in java.