Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Releasing a project which uses JNI

Thread Tools

Releasing a project which uses JNI

Hendrik Maryns
Posts: n/a
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
‘’ (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, 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.

Hendrik Maryns
Ask smart questions, get good answers:

Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE -

iD8DBQFHztGfe+7xMGD3itQRAjqJAJkBRAulaMF9gPcIR5xdEM VwwrVqhwCdFoer

Reply With Quote

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
Releasing a Application which uses ODBC Daniel Pomrehn C++ 1 04-07-2005 03:24 PM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:03 AM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:01 AM
Porting JNI Windows under JNI LINUX + Wine ? Pasturel Jean-Louis Java 5 03-03-2004 07:50 PM
IBM's JNI fails where Sun's JNI works Alex Hunsley Java 4 11-04-2003 10:34 AM