Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

JNI with packages

Thread view: 
stixwix - 22 Feb 2006 11:45 GMT
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
> What OS ?

Linux
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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.