Releasing a project which uses JNI

H

Hendrik Maryns

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-----
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top