JNI with packages

Discussion in 'Java' started by stixwix, Feb 22, 2006.

  1. stixwix

    stixwix Guest

    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
     
    stixwix, Feb 22, 2006
    #1
    1. Advertisements

  2. stixwix

    Chris Uppal Guest

    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
     
    Chris Uppal, Feb 22, 2006
    #2
    1. Advertisements

  3. stixwix

    stixwix Guest

    Chris Uppal wrote:

    > What OS ?
    >

    Linux
     
    stixwix, Feb 23, 2006
    #3
  4. 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
     
    Gordon Beaton, Mar 1, 2006
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sandeep

    VHDL Packages

    Sandeep, Aug 13, 2003, in forum: VHDL
    Replies:
    1
    Views:
    5,333
    Egbert Molenkamp
    Aug 14, 2003
  2. Alex Hunsley

    IBM's JNI fails where Sun's JNI works

    Alex Hunsley, Nov 3, 2003, in forum: Java
    Replies:
    4
    Views:
    1,090
    Alex Hunsley
    Nov 4, 2003
  3. Paul  Smith
    Replies:
    0
    Views:
    898
    Paul Smith
    Nov 18, 2003
  4. Pasturel Jean-Louis

    Porting JNI Windows under JNI LINUX + Wine ?

    Pasturel Jean-Louis, Feb 29, 2004, in forum: Java
    Replies:
    5
    Views:
    1,183
    Pasturel Jean-Louis
    Mar 3, 2004
  5. vasanth
    Replies:
    0
    Views:
    3,229
    vasanth
    Jan 25, 2005
  6. David Lyon
    Replies:
    19
    Views:
    774
    David Lyon
    Apr 24, 2009
  7. bgabrhelik
    Replies:
    0
    Views:
    1,149
    bgabrhelik
    Sep 29, 2009
  8. Ian
    Replies:
    3
    Views:
    364
Loading...