Hi,
I have a java program using JNI that works fine when in the default
(none) package.
If I have a directory called test:
The java code sits in this dir and I compile it from here.
I then run javah which creates the header file in this dir.
I then ggc the c code from here.
- it's all fine.
But in the real world this should be in a package so lets say the java
code goes in a a sub-dir of test called child.
The java code sits in this child dir and I compile it from here.
I change dir to the parent test dir.
I then run javah -jni which creates the header file in this dir (the
header file is now called child_xxx).
I then ggc the c code from here (after editing for the new header file
name).
- I get java.lang.UnsatisfiedLinkError: at the line number that i
call the native method in my java code.
The shared object remains exported as it was for the first working
attempt and I load the lib in the same way in the java code.
What gives...?
Thanks,
Andy
Chris Uppal - 22 Feb 2006 18:16 GMT
> I then ggc the c code from here (after editing for the new header file
> name).
> - I get java.lang.UnsatisfiedLinkError: at the line number that i
> call the native method in my java code.
> The shared object remains exported as it was for the first working
> attempt and I load the lib in the same way in the java code.
What OS ?
-- chris
stixwix - 23 Feb 2006 09:14 GMT
Gordon Beaton - 01 Mar 2006 08:59 GMT
> I then run javah -jni which creates the header file in this dir (the
> header file is now called child_xxx).
Did you provide the fully qualified classname (i.e.
my.package.MyClass) when you ran javah? Did you make the appropriate
changes to the names of the functions in your native source file?
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e