Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JNI with packages

Reply
Thread Tools

JNI with packages

 
 
stixwix
Guest
Posts: n/a
 
      02-22-2006
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

 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      02-22-2006
stixwix wrote:

> 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


 
Reply With Quote
 
 
 
 
stixwix
Guest
Posts: n/a
 
      02-23-2006

Chris Uppal wrote:

> What OS ?
>

Linux

 
Reply With Quote
 
Gordon Beaton
Guest
Posts: n/a
 
      03-01-2006
On 22 Feb 2006 03:45:29 -0800, stixwix wrote:
> 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

--
[ 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python Packages : A loomingproblem? packages might no longer work? (well not on your platform or python version anyway) David Lyon Python 19 04-23-2009 11:10 PM
Search Engine Optimization Packages India, SEO Packages Hyderabad,SEO Packages Firm visioninfosyslinks@gmail.com HTML 0 12-20-2007 08:45 AM
Advice on converting hashed packages to pseudo-hashed packages Ian Perl Misc 3 02-12-2005 12:17 AM
Do the javax.imageio packages replace packages in com.sun.image? Paul Smith Java 0 11-18-2003 02:58 PM
IBM's JNI fails where Sun's JNI works Alex Hunsley Java 4 11-04-2003 10:34 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57