Releasing a project which uses JNI

Discussion in 'Java' started by Hendrik Maryns, Mar 5, 2008.

  1. Hi all,

    I’ve been reading through some autoconf/automake tutorials, googled
    around for stuff like ‘jni jar’, but didn’t find anything useful now.

    I have a proggie which uses JNI with SWIG. I have a hand-made makefile,
    which works fine on my system. However, my colleague can’t get it to
    run properly. No wonder: I have a 64-bit system, he runs a 32-bit Java.
    From the Java part, this should be no problem, of course, but the
    library I build and then invoke with JNI should be compiled for the
    right system, I suppose.

    To summarize (in each case, replace ... as appropriate, it should be
    clear what is meant):
    - two Java packages, de.uni_tuebingen.sfs.lichtenstein.binarytrees and
    de.uni...UI (UI contains, well, UI, binarytrees contains the logic)
    - binarytrees contains a few C files, a SWIG interface file, mona.i, and
    a makefile.
    - if make is invoked in binarytrees, it produces a dynamically loaded
    library named ‘Mona’. This means on my system it will be calles
    ‘libmona.so’ (on Win, this will be mona.dll etc.)
    - I then invoke UI as follows
    java -Djava.library.path=de/uni.../binarytrees de.uni...UI

    This works.

    However, I would like to be able to distribute this program. This leads
    to several problems:
    - the java include paths can differ on other machines (they are now
    hardcoded in the makefile)
    - Even with a jar containing libmona.so, people have to extract it from
    the jar and invoke it with the -D option as above.

    So two questions here: how do I get the proper include paths for JNI
    into my makefile automatically? And is there a way to make a jar file
    (or something similar) which contains the library, or several versions
    of it, and picks the appropriate one depending on the machine the
    program is run on.

    Other suggestions on how to tackle this very welcome, of course.

    TIA, H.
    --
    Hendrik Maryns
    http://tcl.sfs.uni-tuebingen.de/~hendrik/
    ==================
    http://aouw.org
    Ask smart questions, get good answers:
    http://www.catb.org/~esr/faqs/smart-questions.html


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.4-svn0 (GNU/Linux)
    Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

    iD8DBQFHztGfe+7xMGD3itQRAjqJAJkBRAulaMF9gPcIR5xdEMVwwrVqhwCdFoer
    dyK5VAv+vqkoKDAmEDh4yyo=
    =uu9P
    -----END PGP SIGNATURE-----
     
    Hendrik Maryns, Mar 5, 2008
    #1
    1. Advertising

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. Alex Hunsley

    IBM's JNI fails where Sun's JNI works

    Alex Hunsley, Nov 3, 2003, in forum: Java
    Replies:
    4
    Views:
    866
    Alex Hunsley
    Nov 4, 2003
  2. Pasturel Jean-Louis

    Porting JNI Windows under JNI LINUX + Wine ?

    Pasturel Jean-Louis, Feb 29, 2004, in forum: Java
    Replies:
    5
    Views:
    928
    Pasturel Jean-Louis
    Mar 3, 2004
  3. vasanth
    Replies:
    0
    Views:
    2,733
    vasanth
    Jan 25, 2005
  4. vasanth
    Replies:
    0
    Views:
    630
    vasanth
    Jan 25, 2005
  5. Daniel Pomrehn

    Releasing a Application which uses ODBC

    Daniel Pomrehn, Apr 7, 2005, in forum: C++
    Replies:
    1
    Views:
    284
    Victor Bazarov
    Apr 7, 2005
Loading...

Share This Page