problem loading library
Hi there.
I'm trying to load a library by -Djava.library.path=path_to_lib but get error message saying java.lang.UnsatisfiedLinkError.
I'm doing it this way because I'm trying to write a midlet.
So the questions are: Is this possible in a midlet and
if possible what am i doing wrong:
My java code is:
class Hello
{
publicnativevoid sayHello();
publicstaticvoid main(String[] args)
{
Hello h =new Hello();
h.sayHello();
}
}
C code is:
#include <jni.h>
#include"Hello.h"
#include <stdio.h>
#include <math.h>
JNIEXPORTvoid JNICALL Java_Hello_sayHello (JNIEnv *env,
jobject obj)
{
printf("Hello world!\n");
}
My def-file is:
EXPORTS
Java_Hello_sayHello
and my makefile is.
all : Hello.dll
Hello.dll : Hello.o Hello.def
gcc -shared -o Hello.dll Hello.o Hello.def
Hello.o : Hello.c Hello.h
gcc -I"C:\Program Files\Java\jdk1.6.0_01\include" -I"C:\Program Files\Java\jdk1.6.0_01\include\win32" -c Hello.c -o Hello.o
Hello.h : Hello.class
javah -jni Hello
clean :
-del Hello.h
-del Hello.o

