On Tue, Dec 1, 2009 at 12:16 AM, Alex Osborne <a...@meshy.org> wrote:

> Hi David,
>
> David Nolen wrote:
> > So my Java ignorance once again rears it's ugly head. It turns out
> > that JNI dynamic libs can't really be part of a .jar.
>
> I can't say I know much about JNI but I've used some libraries like
> SQLiteJDBC and Qt Jambi which bundle the native libraries in the jar, so
> the consumer of the library can use them just as if they were normal
> java libraries, which is very convenient.  Looking at the source code to
> SQLiteJDBC it looks like what they do is check the platform with
> (System/getPropertly "os.name") and then copy the appropriate lib files
> (extracted from the jar with getResourceAsStream) to /tmp (just using
> java.io.File/createTempFile) and then call System/load on them.


>From what I understand you have 2 two options with JNI libraries:

1. The method you mentioned above.
2. Unpack the JNIs from the .jar and place in a directory that is on
java.library.path or java.ext.dirs.

While it's nice that (1) keeps everything in the .jar I'm not sure if this
will be more complicated to support (I want to use JOGL and SQLiteJDBC)? I
suppose the project would need to specify each JNI that needs loading?


> I'm a little unclear about what are you proposing "lein run" would
> actually do for JNI stuff.  Something like this?
>
> java -cp 'src:classes:lib/*' -Djava.library.path=native-lib/ \
>      clojure.main -i src/gears.clj -e "(gears/-main)"
>
>
Yes.


> What would it set java.library.path to?  Or are suggesting that would be
> configurable in the project.clj?
>

Only necessary with (2). Probably useful to set from project.clj as well.


>
> Cheers,
>
> Alex
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to